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,27 +328,21 @@ public class ItemUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static Field cb_SkullMeta_profile;
|
||||
|
||||
static {
|
||||
try {
|
||||
cb_SkullMeta_profile = SkullMeta.class.getDeclaredField("profile");
|
||||
cb_SkullMeta_profile.setAccessible(true);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSkullTexture(ItemStack item) {
|
||||
if (cb_SkullMeta_profile == null || !CompatibleMaterial.PLAYER_HEAD.matches(item) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) {
|
||||
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);
|
||||
|
||||
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) {
|
||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user