OnInvClick

Discussion in 'Plugin Development' started by ProStriker123, Jul 19, 2014.

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

    ProStriker123

    How can i do that only soups he can click on the inv and he can drop soups and my far away code its :

    @EventHandler
    public void onInvClick(InventoryClickEvent event)
    {
    event.setCancelled(true);
    }

    and how can i do when a player in the server die all the entity's will be removed from the floor

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

    jthort

    What
     
    Asgernohns and jimuskin like this.
  3. Offline

    Asgernohns


    O_O
     
  4. I'm not sure what you mean but I think it's this:
    Code:
        @EventHandler
        public void onInvClick(InventoryClickEvent e) {
            if(!(e.getCurrentItem().getType() == Material.MUSHROOM_SOUP)) {
                e.setCancelled(true);
            }
        }
    And for the item drop canceller:
    Code:
        @EventHandler
        public void onDeath(PlayerDeathEvent event) {
            if(event.getEntity() instanceof Player) {
                event.getDrops().clear();
                }
        }
     
  5. Offline

    ProStriker123

    @megamichiel, Ohh man its works thanks for your help

    @megamichiel, Last question how can i make it with a permission the onInvClick that admins can drop

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

    jimuskin

    ProStriker123 use this:

    Code:
    if(player.hasPermission("the permission")){
    //Do something
    }
    
     
  7. Offline

    fireblast709

Thread Status:
Not open for further replies.

Share This Page