Solved Problems with loop online players

Discussion in 'Spigot Plugin Development' started by dakala, Jun 12, 2018.

  1. So im coding an plugin for ffa,and im using Azazel TabAPI,and im trying to create Staff Online thing,to loop players with permission and it them on tab but im not getting any success.

    Here is my code.


    Code (Text):
            ArrayList<Player> staff = new ArrayList<Player>();
           
            for(int i = 5; i - 4 < Bukkit.getOnlinePlayers().length; i++){
                tab.right(i, "&6" + staff.get(i).getName());
            }
    If somebody can help me i will appreciate it!
     
  2. So are you trying to list how many staff are online on the tab ?
    And your telling if its a staff member by a perm ?

    so it says like Staff Online: 10
     
  3. If its right, in a PlayerJoinEvent add to Staff ArrayList and then use "Staffs Online" + staff.size()
     
  4. Or

    int staffCount = 0;

    login event
    if(p.hasperm("Staff"))
    staffcount ++;

    logout event
    if(p.hasperm("Staff"))
    staffcount --;
     
  5. Im trying to add Staff Names like this:

    Staff Online:
    Jonnyo101
    Staff2
    Staff3