#CheckItem NBT Tutorial

1 messages · Page 1 of 1 (latest)

past mason
#

This tutorial will teach you how to check and remove items with specific nbt data from a player via the CheckItem Expansion https://helpch.at/placeholders#checkitem

WARNING: By enabling GIVE and/or REMOVE placeholders within CheckItem opens your server to a possible exploit vulnerability!
It is Highly Recommended that you use give/remove commands from other plugins and/or vanilla minecraft!
You can follow this tutorial to learn how to remove custom items with the vanilla commands: #1214779736027308042 message

#

To view the information of an item, hold it in your main hand and type /data get entity @s SelectedItem
If you don't receive an output, check if your sendCommandFeedback gamerule is disabled or not.
What you are looking for is a custom nbt value stored under the tag nbt compound.
Once you find your custom nbt value ("executableitems:ei-id": "ArmoryKey") you can plug that into a checkitem placeholder as follows:
%checkitem_nbtstrings:executableitems:ei-id=ArmoryKey%

Sometimes items will have custom nbt values stored inside other nbt compounds such as PublicBukkitValue
Example: PublicBukkitValues: ("executableitems:ei-id": "ArmoryKey")

#

To use these compounds in checkitem you would do as follows:
%checkitem_nbtstrings:PublicBukkitValues..executableitems:ei-id=ArmoryKey%

==

Once you have established a working placeholder, in this case we will use %checkitem_nbtstrings:executableitems:ei-id=ArmoryKey%
The placeholder above will return a yes or no value ||Based on PAPI config||

You can remove the item by adding _remove directly after checkitem, as such: %checkitem_remove_nbtstrings:executableitems:ei-id=ArmoryKey%
BE CAREFUL, parsing this placeholder in any way will remove ALL ArmoryKey from the user's inventory!

You can add an amount modifier (amt:#) as such: %checkitem_remove_nbtstrings:executableitems:ei-id=ArmoryKey,amt:2%
This will remove 2 ArmoryKey from the user it is parsed for.

Checkitem Information: https://helpch.at/placeholders#checkitem

==

Here is a working example for DeluxeMenus

click_requirement:
  requirements:
    haskey:
      type: string equals
      input: '%checkitem_nbtstrings:executableitems:ei-id=ArmoryKey,amt:1%' #Checks if the player has 1 Armory Key
      output: 'yes'
      deny_commands:
      - '[message] Get 1 Armory Key, fool'
click_commands:
- '[console] ei take %player_name% ArmoryKey 1 ' #Removes 1 Armory Key from the player. Recommended to use /ei take instead of using %checkitem_remove_nbtstrings:executableitems:ei-id=ArmoryKey,amt:1%
- '[message] You used 1 Armory Key'
- '[console] minecraft:give %player_name% diamond 1' #Gives the player 1 diamond
- '[message] You received 1 diamond'