how to get type of inventory

Discussion in 'Plugin Development' started by lrdemolition, Aug 23, 2014.

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

    lrdemolition

    if (event.getRawSlot() == 5&&event.getInventory() == Survival)
    that is basically what i am trying to do(check if its slot 5 and the player is using the survival inventory(not creative or crafting table))
    how do i do this
     
  2. Offline

    Gater12

  3. Offline

    Dragonphase

  4. Offline

    lrdemolition

    Gater12 Dragonphase
    how do i create the variable inventory?
    Code:
        @EventHandler
        public void inventory(InventoryClickEvent event) {
            if (event.getRawSlot() == 5&&Inventory.getType() == Survival) {
                event.setCancelled(true);
            }
    like this?:
    Code:
    Inventory Inventory = event.getPlayer().getInventory();
    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  5. Offline

    KaitouKidFTW

    lrdemolition Just check if their gamemode is survival and if they click on slot 5 when clicking in an inventory, cancel the even.
     
  6. Offline

    Dubehh

    lrdemolition

    Don't capitalize your variables.
    Instead of checking if the inventory is survival, just check the players gamemode using
    Code:java
    1. p.getGamemode() == Gamemode.SURVIVAL
     
Thread Status:
Not open for further replies.

Share This Page