Development Assistance PlayerDeathEvent

Discussion in 'Plugin Help/Development/Requests' started by kyleman736, Feb 14, 2015.

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

    kyleman736

    Hi I have been trying to make a plugin that on a players death it drops something. It works, but I want it to work for people who have TCN.Guard permission. I cannot figure out how to get player.hasPermission to work. Thanks.

    Code:
    @EventHandler
        public void onPlayerDeath(PlayerDeathEvent e) {
           
            Player player = event.getPlayer();
           
           
                if (player.hasPermission("TCN.Guard")) {
                    e.getDrops().clear();
                   e.getDrops().add(new ItemStack(Material.COOKED_BEEF, 5));
            }
        }
    
     
  2. @kyleman736 So what is the issue apart from bad identation?
     
  3. Offline

    kyleman736

    Lol i am sorry the copying and pasting screwed up. See, I am trying to simply test if the player has a permission, but it seems that "player" does not work anymore, either I am not doing something right or did it change? Because Without the permission, when anyone dies, they only drop their inventory. I want it so only people with the permission "TCN.Guard" to drop steak on death, while everyone else drops their normal gear.
     
  4. Offline

    pie_flavor

    @kyleman736 I still don't see the problem. Your code does exactly that.
     
  5. Offline

    Gater12

    @kyleman736
    Your event parameter's name is 'e' not 'event'.
     
Thread Status:
Not open for further replies.

Share This Page