fixed a bug where old displayName would be used after name was updated.

This commit is contained in:
Cheese 2015-12-09 08:38:05 +11:00
parent fba88ec231
commit 26c5c419f8
2 changed files with 24 additions and 3 deletions

View File

@ -36,6 +36,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -1723,4 +1724,21 @@ public abstract class Game implements Listener
}
}
}
@EventHandler
public void debug(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().equals("/debugteams"))
{
for (GameTeam team : GetTeamList())
{
event.getPlayer().sendMessage(team.GetFormattedName());
for (Player player : team.GetPlayers(false))
{
event.getPlayer().sendMessage(player.getName() + ": " + team.IsAlive(player));
}
}
}
}
}

View File

@ -79,7 +79,7 @@ public class GameTeam
{
Host = host;
_displayName = name;
_displayName = null;
_name = name;
_color = color;
_spawns = spawns;
@ -178,7 +178,7 @@ public class GameTeam
{
_players.put(player, in ? PlayerState.IN : PlayerState.OUT);
UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _displayName + " Team."));
UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + getDisplayName() + " Team."));
VisibilityManager.Instance.refreshPlayerToAll(player);
}
@ -192,7 +192,7 @@ public class GameTeam
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player);
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
}
UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded."));
UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded."));
}
_players.clear();
@ -323,6 +323,9 @@ public class GameTeam
public String getDisplayName()
{
if (_displayName == null)
return _name;
return _displayName;
}