Staff Pick: Item Bind API
By
DNxCreated: 2016/09/29 06:20:25 UTC-07:00 (8 years and 85 days ago)
Edited: 2016/09/29 06:56:10 UTC-07:00 (8 years and 85 days ago)
Likes: 0
Staff pick as of: 2016/12/07 23:35:33 UTC-08:00 (8 years and 15 days ago)
Denizen Version: 1.0.0
Script Version: 0.01
Description:
Prevent player from abusing the given items.
Usage:
Prefix your item script name with "Bind_".
Example: "Bind_OpenMenuItem"
Download script |
View raw scriptBindItem_Listener:
type: world
debug: false
events:
on player changes gamemode to creative:
- foreach <player.inventory.list_contents>:
- if <def[value].scriptname.starts_with[Bind_]||false> take <def[value]> qty:<player.inventory.quantity[<def[value]>]>
on player drops item:
- if <c.item.scriptname.starts_with[Bind_]||false> determine CANCELLED
on player drags item:
- if <c.item.scriptname.starts_with[Bind_]||false> && <c.raw_slots.filter[is[less].than[<c.inventory.size>]].size.is[more].than[0]> determine CANCELLED
on player clicks in inventory:
- if <c.action.is[==].to[NOTHING]> queue clear
- if <c.action.starts_with[DROP].and[<c.cursor_item.scriptname.starts_with[Bind_].or[<c.item.scriptname.starts_with[Bind_]||false>]||false>]||false> determine CANCELLED
- if <c.item.scriptname.starts_with[Bind_]||false> {
- if <c.action.starts_with[DROP]> determine CANCELLED
- if <c.action.is[==].to[MOVE_TO_OTHER_INVENTORY]> && <c.inventory.inventory_type.is[!=].to[CRAFTING]> {
- determine CANCELLED
}
}
- if <c.cursor_item.scriptname.starts_with[Bind_]||false> {
- if <c.action.starts_with[DROP]> || <c.raw_slot.is[or_less].than[<c.inventory.size>]> {
- determine passively CANCELLED
- inventory update d:<player.inventory>
- queue clear
}
}
- if <c.action.is[==].to[HOTBAR_SWAP]> {
- if <player.inventory.slot[<c.hotbar_button>].scriptname.starts_with[Bind_]||false> && <c.raw_slot.is[or_less].than[<c.inventory.size>]> determine CANCELLED
}
on item recipe formed:
- if <c.recipe.parse[scriptname].filter[starts_with[Bind_]].size.is[more].than[0]> determine CANCELLED
on player death:
- determine <c.drops.exclude[<c.drops.filter[scriptname.starts_with[Bind_]]>]>
on system time hourly:
- webget "http://stats.denizenscript.com/tracker?script=114&version=0.01"
View History