protocolize
protocolize copied to clipboard
inventory error
Describe the bug Kick and error when opening inventory
To Reproduce Steps to reproduce the behavior:
- Write the plugin with code:
ProtocolizePlayer player = Protocolize.playerProvider().player(((Player) invocation.source()).getUniqueId());
final Inventory inventory = new Inventory(InventoryType.GENERIC_9X6).title(ChatElement.ofLegacyText("Inventory name")).onClick(inventoryClick -> inventoryClick.cancelled(true));
List<BaseItemStack> items = new ArrayList<>();
Database.getAllRanks(true).forEach((key, value) -> {
BaseItemStack itemStack = new ItemStack(ItemType.PLAYER_HEAD);
itemStack.displayName(key);
try {
final Optional<MojangSkinDataResult> playerSkin = SkinsRestorerProvider.get().getSkinStorage().getPlayerSkin(key, true);
if (playerSkin.isPresent()) {
CompoundTag skullOwner = itemStack.nbtData().getCompoundTag("SkullOwner");
if (skullOwner == null) {
skullOwner = new CompoundTag();
}
skullOwner.put("Name", new StringTag(key));
CompoundTag properties = skullOwner.getCompoundTag("Properties");
if (properties == null) {
properties = new CompoundTag();
}
final CompoundTag texture = new CompoundTag();
texture.put("Value", new StringTag(playerSkin.get().getSkinProperty().getValue()));
final ListTag<CompoundTag> textures = new ListTag<>(CompoundTag.class);
textures.add(texture);
properties.put("textures", textures);
skullOwner.put("Properties", properties);
itemStack.nbtData().put("SkullOwner", skullOwner);
}
} catch (DataRequestException e) {
e.printStackTrace();
}
items.add(itemStack);
});
inventory.items(items);
player.openInventory(inventory);
Expected behavior The player will not kick and the inventory will open.
Screenshots
Proxy environment Velocity last version installed protocolize and protocolize-legacy-velocity
Minecraft versions used 1.12.2
I guess its a problem with the nbt things and not the Library