Solved Permission wont work

Discussion in 'Plugin Development' started by DaanSander, Jan 10, 2015.

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

    DaanSander

  2. Remove "final"
    Code:java
    1.  
    2. @EventHandler
    3. public void onEvent(EntityDamageEvent event) {
    4. //Check if entity instance of Player
    5. if(!(event.getEntity instanceof Player)) { return; }
    6. Player player = (Player) event.getEntity();
    7. //If the player don't have the permission return
    8. if(!player.hasPermission("your.permission")) { return; }
    9. //Code
    10. }
    11.  
     
  3. Offline

    drpk

    @DaanSander check if the player has permission and then set the event to cancelled?
     
  4. Offline

    InkzzzMC

  5. Offline

    drpk

    @InkzzzMC use getEntity and check if it is an instance of Player
     
  6. Offline

    InkzzzMC

  7. Offline

    drpk

    @InkzzzMC you're checking if the entity is NOT a player.
     
  8. Offline

    InkzzzMC

  9. Offline

    drpk

Thread Status:
Not open for further replies.

Share This Page