mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-27 12:35:12 +01:00
Merge branch 'development' of gitlab.com:Songoda/songodaupdater into development
This commit is contained in:
commit
ebb0434250
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "SongodaCore"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "2.2.3"
|
||||
version: "2.2.4"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -328,30 +328,24 @@ public class ItemUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static Field cb_SkullMeta_profile;
|
||||
public static String getSkullTexture(ItemStack item) {
|
||||
if (!CompatibleMaterial.PLAYER_HEAD.matches(item) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
SkullMeta localSkullMeta = (SkullMeta) item.getItemMeta();
|
||||
Field cb_SkullMeta_profile = localSkullMeta.getClass().getDeclaredField("profile");
|
||||
if (cb_SkullMeta_profile == null) return null;
|
||||
cb_SkullMeta_profile.setAccessible(true);
|
||||
|
||||
static {
|
||||
try {
|
||||
cb_SkullMeta_profile = SkullMeta.class.getDeclaredField("profile");
|
||||
cb_SkullMeta_profile.setAccessible(true);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
GameProfile profile = (GameProfile) cb_SkullMeta_profile.get(localSkullMeta);
|
||||
Iterator<Property> iterator = profile.getProperties().get("textures").iterator();
|
||||
|
||||
public static String getSkullTexture(ItemStack item) {
|
||||
if (cb_SkullMeta_profile == null || !CompatibleMaterial.PLAYER_HEAD.matches(item) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
SkullMeta localSkullMeta = (SkullMeta) item.getItemMeta();
|
||||
GameProfile profile = (GameProfile) cb_SkullMeta_profile.get(localSkullMeta);
|
||||
Iterator<Property> iterator = profile.getProperties().get("textures").iterator();
|
||||
|
||||
return iterator.hasNext() ? iterator.next().getValue() : null;
|
||||
} catch (IllegalArgumentException | IllegalAccessException ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return iterator.hasNext() ? iterator.next().getValue() : null;
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDecodedTexture(String encoded) {
|
||||
return encoded != null ? StringUtils.substringBetween(new String(Base64.getDecoder().decode(encoded)), "texture/", "\"") : null;
|
||||
|
Loading…
Reference in New Issue
Block a user