mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-28 23:27:40 +02: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 NPCSelector selector;
|
||||||
private StoredShops shops;
|
private StoredShops shops;
|
||||||
private final SkullMetaProvider skullMetaProvider = new SkullMetaProvider() {
|
private final SkullMetaProvider skullMetaProvider = new SkullMetaProvider() {
|
||||||
|
private boolean SUPPORT_OWNER_PROFILE = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTexture(SkullMeta meta) {
|
public String getTexture(SkullMeta meta) {
|
||||||
GameProfile profile = NMS.getProfile(meta);
|
GameProfile profile = NMS.getProfile(meta);
|
||||||
@ -118,8 +120,22 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTexture(String string, SkullMeta meta) {
|
public void setTexture(String string, SkullMeta meta) {
|
||||||
UUID uuid = meta.getOwningPlayer() == null ? UUID.randomUUID() : meta.getOwningPlayer().getUniqueId();
|
GameProfile profile = NMS.getProfile(meta);
|
||||||
NMS.setProfile(meta, new GameProfile(uuid, string));
|
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;
|
private CitizensSpeechFactory speechFactory;
|
||||||
|
@ -189,7 +189,7 @@ public class ShopTrait extends Trait {
|
|||||||
NPCShopItem item = shopPage.getItem(i);
|
NPCShopItem item = shopPage.getItem(i);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
slot.setItemStack(item.display);
|
slot.setItemStack(item.getDisplayItem(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
final int idx = i;
|
final int idx = i;
|
||||||
@ -405,7 +405,7 @@ public class ShopTrait extends Trait {
|
|||||||
public void initialise(MenuContext ctx) {
|
public void initialise(MenuContext ctx) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
if (modified.display != null) {
|
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")),
|
ctx.getSlot(9 * 3 + 3).setItemStack(new ItemStack(Util.getFallbackMaterial("OAK_SIGN", "SIGN")),
|
||||||
"Set message to send on click, currently:",
|
"Set message to send on click, currently:",
|
||||||
|
Loading…
Reference in New Issue
Block a user