Check for permissions except for OP permissions.

Discussion in 'Plugin Development' started by TheEyeMonster, Oct 5, 2013.

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

    TheEyeMonster

    Code:TestClass.java
    1. @EventHandler
    2. public void onPlayerJoinEvent(PlayerJoinEvent event) {
    3.  
    4. Player player = event.getPlayer();
    5. if (player.isOp()) {
    6. player.sendMessage("You are op.");
    7. }
    8.  
    9. }


    How can I check if the player has the permission, but if he/she doesn't have the permission but is OP also return false.
    I don't want it to count Operator as true.
     
  2. Offline

    adam753

    Code:
    if(player.hasPermission("blah"))
    
    I think Op has all permissions though, so you might struggle with that.
     
  3. Offline

    TheEyeMonster

    But I need to check if someon has the permission, but Opped players may not count as true.
     
  4. Offline

    Wolvereness Bukkit Team Member

    Change the permission's default to false.
     
  5. Offline

    TheEyeMonster

    Found out already, thanx btw.

    Code:
    @EventHandler
    public void onPLayerJoinEvent(PlayerJoinEvent event) {
     
    Player player = event.getPlayer();
    if (!player.hasPermission("permission.here")) {
    if (player.isOp()) {
    //nothing
    }
    else {
    event.setCancelled(true);
    player.sendMessage("§cNope!");
    }
       }
     
    }
    
     
Thread Status:
Not open for further replies.

Share This Page