Creative shift clicking and pressing Q

Discussion in 'Plugin Development' started by seanliam2000, Jun 22, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    seanliam2000

    So I have been searching for a while now for how to stop the player from shift clicking an item out of their inventory and pressing q while in creative mode and I have this:
    It doesn't stop the shift clicking or q(Probably need a drop event but not sure how to cancel it) but it works fine in survival
    Code:java
    1.  
    2. @EventHandler
    3. public void onHelmetRemove(InventoryClickEvent event)
    4. {
    5. if (event.getSlotType() == SlotType.ARMOR) {
    6. event.setCancelled(true);
    7. event.getWhoClicked().closeInventory();
    8. }
    9. }
    10.  
     
  2. Offline

    Drkmaster83

    You can check the ClickType of given InventoryClickEvent. From there, there's a ClickType.DROP and a ClickType.CONTROL_DROP. Same for a shift click: it can be accessed from the event. Event.isShiftClick()
     
  3. Offline

    seanliam2000

    Oh okay I will try this out and report back :)

    @Drkmaster83 Okay the survival portion works great but I can still move it around in creative. I am going to try some more stuff with drop events to cancel the q in creative
     
    Last edited: Jun 24, 2015
Thread Status:
Not open for further replies.

Share This Page