Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
fix nbt code
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniFoldi committed May 9, 2021
1 parent da9e197 commit 0fbcd26
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/com/danifoldi/bungeegui/main/GuiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,20 @@ void open(String name, ProxiedPlayer player, @Nullable String target) {
}
}

CompoundTag tag = (CompoundTag)item.getNBTTag();

if (guiItem.getValue().isEnchanted()) {
ListTag<CompoundTag> enchantments = new ListTag<>(CompoundTag.class);
CompoundTag enchantment = new CompoundTag();
enchantment.put("id", new StringTag("minecraft:unbreaking"));
enchantment.put("lvl", new ShortTag((short)1));
enchantments.add(enchantment);
((CompoundTag)item.getNBTTag()).put("Enchantments", enchantments);
((CompoundTag)item.getNBTTag()).put("HideFlags", new IntTag(99));
((CompoundTag)item.getNBTTag()).put("overrideMeta", new ByteTag((byte)1));
tag.put("Enchantments", enchantments);
}

tag.put("HideFlags", new IntTag(99));
tag.put("overrideMeta", new ByteTag((byte)1));

inventory.setItem(guiItem.getKey(), item);
}

Expand Down

0 comments on commit 0fbcd26

Please sign in to comment.