Solved Disable specific item to chest

Discussion in 'Plugin Development' started by 2hot4you2, Jan 31, 2016.

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

    2hot4you2

    Hello,

    I'm busy with a script and i want to disable that a book and quill or written book can go inside a chest.
    I try to disable moving the item but that isn't a solution.:

    public void onPlayerClickInventory(InventoryClickEvent event) {
    Player p = (Player) event.getWhoClicked();
    Material t = event.getCurrentItem().getType();
    if (t != Material.WRITTEN_BOOK || t != Material.BOOK_AND_QUILL){
    event.setCancelled(true);
    }
    }


    Can someone please tell me the best way to do it?

    Greets,
     
  2. Offline

    Zombie_Striker

    @2hot4you2
    Can you explain little more? In what way does your code not work?
     
  3. Offline

    2hot4you2

    @Zombie_Striker i want to disable the possibility to put a book or book and quill inside a chest.
    this way i did this give's the problem that they can't move it anywhere in their inventory
    ( or some time's even can't get them inside their inventory if you are in gamemode).

    i hope you can help me out. Thanks already!
     
  4. Offline

    Zombie_Striker

    @2hot4you2
    Check if the inventory.getTitle() is equal to "chest" or "double-chest". If this returns true, then the player is moving the book into a chest. If not, then he's moving it around in their inventory.
     
  5. Offline

    2hot4you2

  6. Offline

    WolfMage1

    Solved?
     
  7. Offline

    2hot4you2

Thread Status:
Not open for further replies.

Share This Page