Need some TabAPI help

Discussion in 'Plugin Development' started by skipperguy12, Mar 16, 2013.

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

    skipperguy12

    Hey guys, so I have made a team plugin with Red team and Blue team.

    I need to somehow place players into the correct category, but how do I check if a certain slot is null/""?

    Please help, I need it to look like this:
    RED | BLUE
    ---------------
    p1 | p2
    p3 | p4

    I have a join command, so I could perform a TabAPI.updatePlayer to every player in the server there?

    I mainly need help adding the players.
     
  2. Offline

    chasechocolate

  3. Offline

    skipperguy12

    chasechocolate

    Yep, and i'm quite confused.

    This is what I have now, but it doesn't set the player to the "next" slot available, and how can I put him in a certain column?

    Code:
       
        @EventHandler
        public void playerLogin(PlayerLoginEvent e){
            final Player p = e.getPlayer();
            TabAPI.setPriority(plugin, p, 0);
            Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
                public void run(){
                    //TabAPI.updatePlayer(p);
                    updateTab(p);
                }
            }, 2);
     
     
        }
     
            public void updateTab(Player p){ //update the tab for a player
              TabAPI.setTabString(plugin, p, 0, 0, ChatColor.RED + "Red Team: " + ProjectAnvil.red.size(), 0);
              TabAPI.setTabString(plugin, p, 0, 1, ChatColor.BLUE + "Blue Team: "+ ProjectAnvil.blue.size(), 0);
              TabAPI.setTabString(plugin, p, 1, 0, ChatColor.RED + "----------", 0);
              TabAPI.setTabString(plugin, p, 1, 1, ChatColor.BLUE + "---------", 0);
             
             
              TabAPI.setTabString(plugin, p, 0, 0, p.getName()+ ((p.getName().length() < 15) ? TabAPI.nextNull(): ""));
              TabAPI.updatePlayer(p);
     
            }
     
            public void removePlayer(Player p){ //player died or left, return priority
              TabAPI.setPriority(plugin, p, -2); //-2 means this plugin isn't using the tab anymore, dont show
              TabAPI.updatePlayer(p); //always good to update the player after priority change so that the plugin with priority gets displayed
                                             
            //other code
     
            }
        
     
  4. Offline

    macguy8

    skipperguy12
    Not sure you get how tabAPI works.
    It's a grid type thing, you'll have to know where your lines (the team and the -----) ends, and then make a for loop that adds to it, and loops back down when it hits the edge of the tab bar
     
  5. Offline

    rockdude

    me nether
    skipperguy
     
  6. Offline

    macguy8

    rockdude
    I'm pretty sure this thread has been solved already
     
Thread Status:
Not open for further replies.

Share This Page