Fixes issue for skin not found errors.

This commit is contained in:
Brianna 2019-05-12 16:31:32 -04:00
parent d2a8ab6ed0
commit 0406773bbd
5 changed files with 17 additions and 6 deletions

View File

@ -27,6 +27,8 @@ public class CommandBase64 extends AbstractCommand {
String encodededStr = Methods.getEncodedTexture(item);
if (encodededStr == null) return ReturnType.FAILURE;
player.sendMessage(instance.getReferences().getPrefix());
player.sendMessage(encodededStr);

View File

@ -26,6 +26,9 @@ public class CommandUrl extends AbstractCommand {
if (!item.hasItemMeta() || !(item.getItemMeta() instanceof SkullMeta)) return ReturnType.FAILURE;
String encodededStr = Methods.getEncodedTexture(item);
if (encodededStr == null) return ReturnType.FAILURE;
String url = Methods.getDecodedTexture(encodededStr);
player.sendMessage(instance.getReferences().getPrefix());

View File

@ -34,6 +34,9 @@ public class ItemListeners implements Listener {
event.getItem().removeMetadata("EHE", plugin);
String encodededStr = Methods.getEncodedTexture(item);
if (encodededStr == null) return;
String url = Methods.getDecodedTexture(encodededStr);
if (url == null) return;

View File

@ -27,8 +27,10 @@ public class LoginListeners implements Listener {
Player player = event.getPlayer();
String encodededStr = Methods.getEncodedTexture(player);
String url = Methods.getDecodedTexture(encodededStr);
if (encodededStr == null) return;
String url = Methods.getDecodedTexture(encodededStr);
String tagStr = "Player Heads";

View File

@ -15,10 +15,7 @@ import org.bukkit.inventory.meta.SkullMeta;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.UUID;
import java.util.*;
public class Methods {
@ -52,7 +49,11 @@ public class Methods {
Field localField = localSkullMeta.getClass().getDeclaredField("profile");
localField.setAccessible(true);
GameProfile profile = (GameProfile) localField.get(localSkullMeta);
Property property = profile.getProperties().get("textures").iterator().next();
Iterator<Property> iterator = profile.getProperties().get("textures").iterator();
if (!iterator.hasNext()) return null;
Property property = iterator.next();
return property.getValue();
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();