1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Vanilla GUI anti dupe fixes.

Discussion in 'Snippets' started by Dovias, Jan 14, 2020.

  1. Dovias

    Dovias Member

    Joined:
    Dec 8, 2019
    Messages:
    3
    Likes Received:
    0
    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 (Text):
    1. import:
    2.   org.bukkit.event.inventory.InventoryType
    3.   org.bukkit.event.inventory.InventoryAction
    4.  
    5. on inventory click:
    6.   if event.getWhoClicked().getOpenInventory().getTopInventory().getType() is InventoryType.CHEST: #You can change type to your's gui Type.
    7.     if event.getWhoClicked().getOpenInventory().getTopInventory().getTitle() is "Name of chest":
    8.       if event.getAction() is InventoryAction.COLLECT_TO_CURSOR:
    9.         if "%event.getWhoClicked().getOpenInventory().getTopInventory().getContents()%" contains         "%event.getCursor().asOne()%":
    10.           cancel event

    • Anti "lock item in slot that contains air" whenever inventory click event is cancelled
      Requires skript-mirror:
    Code (Text):
    1. import:
    2.   org.bukkit.event.inventory.InventoryDragEvent
    3.  
    4. on InventoryDragEvent:
    5.   if event-inventory's name is "Title name of inventory":
    6.     cancel event
     
Loading...