ItemDrop Event not working. - Block item click if player has another inventory opened?

Discussion in 'Plugin Development' started by deathknife, Oct 30, 2013.

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

    deathknife

    Code:java
    1. @EventHandler
    2. public void DropEvent(PlayerDropItemEvent event)
    3. {
    4. Bukkit.broadcastMessage("Test");
    5. event.setCancelled(true);
    6. }


    Doesn't get activated or anything, it doesn't broadcast "Test". Yes, it's imported. Nothing shows up in console. I have other events in same class and they work.
    I'm also wondering, will PlayerDropItemEvent prevent dropping items on death if cancelled? If not, is there a way to stop only one particular item from dropping on death?



    I want to disable clicking if player has any inventory open that is not his. For example, when he has a chest opened he can't click any items (In both inventories), but if he only has his own inventory open he can click. I have tried this but no luck.

    Code:java
    1. if(event.getInventory().equals(player.getInventory()))
    2. {
    3. Bukkit.broadcastMessage("A");
    4. }
     
  2. Offline

    The_Coder

    Is the listener registered and your class implement Listener?
     
  3. Offline

    deathknife

    Yes, I have other events such as Click event, and they seem to work.

    EDIT: There was problem with my class, somehow. It's fixed by now, but is there any way to prevent certain item to drop on block death?
     
Thread Status:
Not open for further replies.

Share This Page