Solved TAGAPI - how do i refresh ?? (wont work)

Discussion in 'Plugin Development' started by ahuby09, Apr 9, 2014.

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

    ahuby09

    I have been using this when a player moves so that it will update but it still doesn't , the other players have to leave and join to see the new game tags , how would i make it so that it will just refrsh without having to leave ?
    Code:
    TagAPI.refreshPlayer((Player) e.getPlayer().getWorld().getPlayers());
     
  2. Offline

    bennie3211

    after every change, refresh it again. Im not sure if it can be used in playerMoveEvent ;s
     
  3. Offline

    ahuby09

    i do refresh each change it doesn't seem to work , ill try again though
     
  4. Offline

    xTrollxDudex

    ahuby09
    You cannot refresh a list of players as a single player, loop through each one and refresh for that player
     
  5. Offline

    ahuby09

    Thanks are you sure that it will update without having to relog
     
  6. ahuby09 Only real way of knowing is to test. But it should do. At least, it will call the method for each player, the rest is down to TagAPI (which I'm sure works fine).
     
  7. Offline

    ahuby09

    ok thanks

    still doesn't work heres my code
    Code:text
    1.  
    2. @EventHandler
    3. public void onNameTag(AsyncPlayerReceiveNameTagEvent e) {
    4. for(Player t : Bukkit.getOnlinePlayers()){
    5. TagAPI.refreshPlayer(t);
    6. }
    7. for(Player p : Bukkit.getOnlinePlayers()){
    8. if(TeamBlue.contains(p)){
    9. e.setTag("BLUE " + e.getPlayer().getName());
    10. }
    11. }
    12. }
    13. [/sytax]
    14.  
    15. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  8. ahuby09 Wouldn't it make sense to refresh AFTER you've updated?
     
  9. Offline

    ahuby09

    st
    ill wont work
     
  10. ahuby09 What doesn't work? Does the method fire? Do you get any errors?
     
  11. Offline

    ahuby09

    idk , i get no errors or nothing , it only works when people relog back in which isn't any good for what im attempting to do
     
  12. ahuby09 Try this:

    PHP:
    @EventHandler
    public void onNameTag(AsyncPlayerReceiveNameTagEvent event) {
        if(
    teamBlue.contains(event.getNamedPlayer()) {
            
    event.setTag("BLUE "+event.getNamedPlayer().getName());
        }
    }
    By the way, adding "BLUE " in front of everyone's name might not be a good idea. You might want to look into team prefixes.
     
  13. Offline

    ahuby09

    ok thanks i just need to wait for osmeone to come on server to test, (which isn't very offen)
     
  14. Offline

    xTrollxDudex

    ahuby09
    ._. If you didn't know you have to call the event by refreshing the player name FIRST.
     
  15. Offline

    ahuby09

    it didn't work anyway even when i did got it working now thanks anyway
     
Thread Status:
Not open for further replies.

Share This Page