Fixed duplicate entries when adding/removing players

Some refractoring
This commit is contained in:
unknown
2014-04-21 17:45:32 +02:00
parent 9315227906
commit c82113dc22
9 changed files with 153 additions and 120 deletions

View File

@ -141,9 +141,21 @@ public class TFM_Util
TFM_Util.bcastMsg(adminName + " - " + action, (isRed ? ChatColor.RED : ChatColor.AQUA));
}
public static String getIp(Player player)
public static String getIp(OfflinePlayer player)
{
return player.getAddress().getAddress().getHostAddress().trim();
if (player instanceof Player)
{
return ((Player) player).getAddress().getAddress().getHostAddress().trim();
}
final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(player.getUniqueId());
if (entry == null)
{
return null;
}
return entry.getIps().get(0);
}
public static String formatLocation(Location location)
@ -155,7 +167,7 @@ public class TFM_Util
Math.round(location.getZ()));
}
public static String formatPlayer(Player player)
public static String formatPlayer(OfflinePlayer player)
{
return player.getName() + " (" + player.getUniqueId() + ")";
}