Remove redundant player IP lookup call.

This commit is contained in:
cnaude 2015-01-17 13:03:42 -07:00
parent 5d2bb066b8
commit 114e94a50f
2 changed files with 6 additions and 4 deletions

View File

@ -1380,9 +1380,11 @@ public class PurpleIRC extends JavaPlugin {
logError(e.getMessage());
}
}
public String getPlayerHost(Player player) {
final String playerIP = player.getAddress().getAddress().getHostAddress();
public String getPlayerHost(final String playerIP) {
if (playerIP == null) {
return "unknown";
}
if (hostCache.containsKey(playerIP)) {
return hostCache.get(playerIP);
} else {

View File

@ -548,7 +548,7 @@ public class ChatTokenizer {
String group = plugin.getPlayerGroup(player);
String displayName = player.getDisplayName();
String playerIP = player.getAddress().getAddress().getHostAddress();
String host = plugin.getPlayerHost(player);
String host = plugin.getPlayerHost(playerIP);
String worldName = "";
String worldAlias = "";
String worldColor = "";