Per Arena Tablist

Discussion in 'Plugin Development' started by MrGriefer_, Feb 25, 2017.

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

    MrGriefer_

    I'm currently working on my mini game plugin, and really want to know how to make per arena tablist that shows all players in the arena. Do I use packets? If so which type of packet?
     
  2. Offline

    Zombie_Striker

  3. Offline

    MrGriefer_

    Can you show me some examples on how to use it, I'm trying to make the list size same as the amount of players in the arena. And when players leave the arena they get the default tab list!!! And their names gets colored when joining.
     
  4. Offline

    Zombie_Striker

    @MrGriefer_
    Well, first you will need to initialize the tablist.
    Code:
    @EventHandler
    public void onJoin(PlayerJoinEvent e){
    PlayerList list = new PlayerList(e.getPlayer(),SIZE);
    //You can choose any size for this.
    list.initTable();
    }
    , Replace "SIZE" with the amount of tabs you want the player to have. Currently, there is no way to change the amount of tabs. I may add this feature in the future. Once I add the feature, all provide the code for changing the tablist. For now, set it to the maximum you feel comfortable having, and let the other tabs be blank.

    After this, once the player leave the arena, reset the tablist using:
    This will set it back to the default tablist.

    When you want them to have colored names, you want to remove their current name and then add the one with color codes using
    Code:
    PlayerTabList#removePlayer(Player player) ;
    PlayerTabList#addExistingPlayer(int id, String name, OfflinePlayer player)
    
    Where "id" is the slot you want to add the player to (I will add a feature in the future for finding "open" slots. For now, since you want all names to be colored, just clear the tablist using Tablist#clearAll and then increase the id for every player).
     
Thread Status:
Not open for further replies.

Share This Page