mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 04:35:50 +01:00
Fix legacy skull texture loading
This commit is contained in:
parent
fda3c9d5c9
commit
aa59e15002
@ -109,6 +109,8 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
private NPCSelector selector;
|
||||
private StoredShops shops;
|
||||
private final SkullMetaProvider skullMetaProvider = new SkullMetaProvider() {
|
||||
private boolean SUPPORT_OWNER_PROFILE = true;
|
||||
|
||||
@Override
|
||||
public String getTexture(SkullMeta meta) {
|
||||
GameProfile profile = NMS.getProfile(meta);
|
||||
@ -118,8 +120,22 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
|
||||
@Override
|
||||
public void setTexture(String string, SkullMeta meta) {
|
||||
UUID uuid = meta.getOwningPlayer() == null ? UUID.randomUUID() : meta.getOwningPlayer().getUniqueId();
|
||||
NMS.setProfile(meta, new GameProfile(uuid, string));
|
||||
GameProfile profile = NMS.getProfile(meta);
|
||||
if (profile == null) {
|
||||
if (SUPPORT_OWNER_PROFILE) {
|
||||
try {
|
||||
profile = new GameProfile(meta.getOwnerProfile().getUniqueId(),
|
||||
meta.getOwnerProfile().getName());
|
||||
} catch (Exception e) {
|
||||
SUPPORT_OWNER_PROFILE = false;
|
||||
}
|
||||
}
|
||||
if (profile == null) {
|
||||
profile = new GameProfile(UUID.randomUUID(), null);
|
||||
}
|
||||
}
|
||||
profile.getProperties().put("textures", new Property("textures", string));
|
||||
NMS.setProfile(meta, profile);
|
||||
}
|
||||
};
|
||||
private CitizensSpeechFactory speechFactory;
|
||||
|
@ -189,7 +189,7 @@ public class ShopTrait extends Trait {
|
||||
NPCShopItem item = shopPage.getItem(i);
|
||||
|
||||
if (item != null) {
|
||||
slot.setItemStack(item.display);
|
||||
slot.setItemStack(item.getDisplayItem(null));
|
||||
}
|
||||
|
||||
final int idx = i;
|
||||
@ -405,7 +405,7 @@ public class ShopTrait extends Trait {
|
||||
public void initialise(MenuContext ctx) {
|
||||
this.ctx = ctx;
|
||||
if (modified.display != null) {
|
||||
ctx.getSlot(9 * 4 + 4).setItemStack(modified.display);
|
||||
ctx.getSlot(9 * 4 + 4).setItemStack(modified.getDisplayItem(null));
|
||||
}
|
||||
ctx.getSlot(9 * 3 + 3).setItemStack(new ItemStack(Util.getFallbackMaterial("OAK_SIGN", "SIGN")),
|
||||
"Set message to send on click, currently:",
|
||||
|
Loading…
Reference in New Issue
Block a user