Script items (items defined with QLD Minecraft using the Denizen script system) can contain individual data values supported by QLD Minecraft using the
lore element. This feature allows you to use a single script item as a item type, however each item of this type has a slight difference or variation.
An example of this in use is plot deeds. All plot deeds are of script item
qldminecraft_plotdeed_item, however each item of this type in the game contains a unique identifier, one for each plot within the game.
For QLD Minecraft to understand if a script item items should be treated uniquely or as a group, the lore needs to contain a identifier in a recognised format.
This identifier is hidden in the items lore, on the first line after the last
: character. To further disguise this identifier from the player, most items built into QLD Minecraft change the text colour of the
: and identifier characters to black.
Item pricing is stored within QLD Minecraft and can be manually set by developers. Both material and script items can have a price value.
Script items that contain an identifier within its lore, are treated as individual/unique items and can contain different pricing.
Not all items in QLD Minecraft have a value, or a price set. These items should not be bought or sold by vendors or NPCs, however trading such items between players should not be prevented.
In game, you can use the command /price (<item>|iteminhand) to display an items price. Script items that contain an identifier can be represented by the script_item_name:identifier
displays the price of a carrot
displays the price of the item in the players hand
displays the price of the plot deed for property id 512
You can use the procedure
qldminecraftp.price.get with a item as its context. This will result in either the items price as an integer or -1 if the item does not have a value.
# Get the value of the item in the players hand- define value:<proc[qldminecraftp.price.get].context[<player.item_in_hand>]>
In game, you can use the command /price (<item>|iteminhand) [price] to set an items price. Script items that contain an identifier can be represented by the script_item_name:identifier
/price carrot 1
sets the price of a carrot to 1 copper coin
/price iteminhand 10000
sets the price of the item in the players hand to 1 gold coin
/price qldminecraft_plotdeed_item:512 12345
sets the price of the plot deed for property id 512 to 1 gold coin, 23 silver coins and 45 copper coins
/price wooden_sword -1
sets the price of a wooden sword to no value
You can use the task
qldminecraft.price.set with an item and a integer value as its definition.
# Sets the value of the item in the players hand to 1 gold, 50 silver- run qldminecraft.price.set def:<player.item_in_hand>|15000
At some point, you may need to delete items that have been previously created because they are no longer required or are now invalid eg. A plot deed item to a plot that no longer exists. This can be easily done by using the task
qldminecraft.item.remove with a definition of the item.
Whenever an item that matches comes into contact, it will be removed from gameplay.
# Mark a plot deed for deletion within the game- define plotdeed:<proc[qldminecraftp.plot.createdeed].context>- run qldminecraft.item.remove def:<[plotdeed]>
Items that are marked for removal can be removed from an inventory item manually using the task
qldminecraft.item.remove_marked passing an inventory item as a definition.
# Delete all marked items from the players inventory- run qldminecraft.item.remove_marked def:<player.inventory>