Prevent a item from being put in a chest

Discussion in 'Plugin Development' started by MaTaMoR_, Apr 5, 2015.

Thread Status:
Not open for further replies.
  1. So how i can prevent a item from being put in a chest ? I tried 1000 things but it doesn't work :/
     
  2. Offline

    nverdier

  3. Offline

    Zombie_Striker

    Just cancel InventoryEvent if the inventory block is that chest.
     
  4. i tried with
    Code:
    if(event.getClickedInventory().getType() != InventoryType.PLAYER);
    if(event.getInventory().getType() != InventoryType.PLAYER);
    
    And it don't work
     
  5. Offline

    Zombie_Striker

    What part of this doesn't work? Does it not fire the Event? Does it not get past that Statement?
     
  6. With the first option it cancel all clicks even when i don't have any chest opened, and with the second options it let my put the item inside the chest (it shouldn't) and when i try to take it back i can't.
     
  7. Offline

    Zombie_Striker

    Why not change != PLAYER to == CHEST
     
  8. Cuz i wanna cancel all type of iventorys except player inventory
     
  9. Offline

    Zombie_Striker

    Well, then just try a long If Statment ( if(== Chets|| == Furnance|| == EnchantmentTable ect.))

    This is just an idea. I have no idea why it wouldn't work.
     
  10. It should be the same.
     
Thread Status:
Not open for further replies.

Share This Page