Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(final GameProfile profile, final boolean requireSecure) {
- final Property textureProperty = Iterables.getFirst(profile.getProperties().get("textures"), null);
- if (textureProperty == null) {
- return new HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture>();
- }
- final MinecraftTexturesPayload result;
- try {
- final String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8);
- result = gson.fromJson(json, MinecraftTexturesPayload.class);
- } catch (final JsonParseException e) {
- LOGGER.error("Could not decode textures payload", e);
- return new HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture>();
- }
- if (result == null || result.getTextures() == null) {
- return new HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture>();
- }
- for (final Map.Entry<MinecraftProfileTexture.Type, MinecraftProfileTexture> entry : result.getTextures().entrySet()) {
- if (!isWhitelistedDomain(entry.getValue().getUrl())) {
- LOGGER.error("Textures payload has been tampered with (non-whitelisted domain)");
- return new HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture>();
- }
- }
- return result.getTextures();
- }
Add Comment
Please, Sign In to add comment