Stop shift click and item ghosting

Discussion in 'Plugin Development' started by arnie231, Feb 11, 2013.

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

    arnie231

    ok so iam trying to update a plugin of mine and i havent coded for a long time and am stuck with this one

    Iam trying to stop the user placing the item into the armor slot or shift clicking it into the slot but if they place it there it will drop the item and leave a ghost item and i cant get shift clicking to stop

    Code:java
    1.  
    2. public class ArmourControl
    3. implements Listener
    4. {
    5. @EventHandler(priority=EventPriority.NORMAL)
    6. public void onInventoryClick(InventoryClickEvent event)
    7. {
    8. Player player = (Player)event.getWhoClicked();
    9.  
    10. if (Main.Config.getBoolean("Control.Armour") == true)
    11. {
    12. if ((event.getSlotType().name().equals("HELMET")) || (event.getSlotType().name().equals("ARMOR")) || (event.getSlotType().name().equals("LEGGINGS")) || (event.getSlotType().name().equals("BOOTS")))
    13. {
    14. if ((event.isLeftClick() == true) && (event.isShiftClick() == false)){
    15. int item = event.getCursor().getTypeId();
    16. if (!player.hasPermission("SIP.Armour.Leather"))
    17. {
    18. if ((item == 298) || (item == 299) || (item == 300) || (item == 301))
    19. {
    20. Chat.ArmourMessage(player);
    21. event.setCancelled(true);
    22. }
    23. }
    24. }
    25. }
    26. }
    27. }
    28. }
    29.  
     
  2. Offline

    jorisk322

    player.updateinventory() should fix the ghost item.
    Also, the information in this thread could help you.
     
Thread Status:
Not open for further replies.

Share This Page