mirror of
https://github.com/songoda/EpicHeads.git
synced 2024-11-26 04:25:16 +01:00
Fixes issue for skin not found errors.
This commit is contained in:
parent
d2a8ab6ed0
commit
0406773bbd
@ -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);
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user