Skip to content

Commit 78f3748

Browse files
committed
Fix item example in README
1 parent b7719f1 commit 78f3748

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ if(compound.hasKey(dataKey)){
6363
player.sendMessage(ChatColor.GOLD + "Got: " + ChatColor.GREEN + compound.getString(dataKey));
6464
} else {
6565
compound.setString(dataKey, String.join(" ", args)); // set it to command arguments
66-
ItemNBTUtil.setNBTTag(compound, item);
66+
item = ItemNBTUtil.setNBTTag(compound, item); // setNBTTag returns a new item and does not modify it
67+
player.getInventory().setItemInMainHand(item); // overwrite the item to apply the tag
6768
}
6869
```
6970

0 commit comments

Comments
 (0)