These not really are snippets but, these are useful things which prevent some annoying bugs, or dupes within vanilla GUI's
- Anti "Move all items from container to player's cursor" dupe
Requires skript-mirror:
Code:
import:
org.bukkit.event.inventory.InventoryType
org.bukkit.event.inventory.InventoryAction
on inventory click:
if event.getWhoClicked().getOpenInventory().getTopInventory().getType() is InventoryType.CHEST: #You can change type to your's gui Type.
if event.getWhoClicked().getOpenInventory().getTopInventory().getTitle() is "Name of chest":
if event.getAction() is InventoryAction.COLLECT_TO_CURSOR:
if "%event.getWhoClicked().getOpenInventory().getTopInventory().getContents()%" contains "%event.getCursor().asOne()%":
cancel event
- Anti "lock item in slot that contains air" whenever inventory click event is cancelled
Requires skript-mirror:
Code:
import:
org.bukkit.event.inventory.InventoryDragEvent
on InventoryDragEvent:
if event-inventory's name is "Title name of inventory":
cancel event