Getting Certain Players

Discussion in 'Plugin Development' started by Jbitters3, Sep 9, 2013.

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

    Jbitters3

    I am creating a staff plugin, and when you type /staff it gets the number of online staff players then prints their names. I am stuck on a point where I need the staff members to have a permission, so it does not get all of the players instead of the sender having the permission.
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd , String CommandLabel , String[] args){
    2. if(args[0].equalsIgnoreCase("staff")){
    3. if(sender.hasPermission("staff.online"))
    4. sender.sendMessage("Staff:");
    5. }
    6. return true;
    7.  
    8. }
     
  2. Code:java
    1. for(Player p : Bukkit.getOnlinePlayers())
    2. {
    3. if(p.hasPermission(staff.staff) //replace by your permisson
    4. {
    5. sender.sendMessage(ChatColor.RED + p.getName());
    6. }
    7. }
    8. sender.sendMessage("------------"); //finish
     
  3. Offline

    The_Doctor_123

    Run through all the players online and check if they have that permission.

    EDIT: Ninja'd..
     
Thread Status:
Not open for further replies.

Share This Page