diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 0b54138c0..59b019540 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -86,7 +86,7 @@ public class ServerManager extends MiniPlugin private NautHashMap _serverNpcShopMap = new NautHashMap(); private NautHashMap _serverInfoMap = new NautHashMap(); private NautHashMap _serverUpdate = new NautHashMap(); - private NautHashMap _serverPortalLocations = new NautHashMap(); + private NautHashMap _portalToServerKey = new NautHashMap(); private ClansServerShop _clansShop; @@ -185,15 +185,16 @@ public class ServerManager extends MiniPlugin return; } - String serverName = _serverPortalLocations.get(player.getLocation().getBlock().getLocation().toVector()); + String serverKey = _portalToServerKey.get(player.getLocation().getBlock().getLocation().toVector()); - if (serverName != null) + if (serverKey != null) { List serverList = new ArrayList(); - - if (hasServerNpc(serverName)) - serverList.addAll(getServerList(serverName)); - + + Collection servers = getServerList(serverKey); + if (servers != null && servers.size() > 0) + serverList.addAll(servers); + int slots = 1; if (serverList.size() > 0) @@ -347,9 +348,9 @@ public class ServerManager extends MiniPlugin } } - public Collection getServerList(String serverNpcName) + public Collection getServerList(String serverKey) { - return _serverKeyInfoMap.get(serverNpcName); + return _serverKeyInfoMap.get(serverKey); } public Set getAllServers() @@ -362,11 +363,6 @@ public class ServerManager extends MiniPlugin return _serverInfoMap.get(serverName); } - public boolean hasServerNpc(String serverNpcName) - { - return _serverKeyInfoMap.containsKey(serverNpcName); - } - @EventHandler public void updatePages(UpdateEvent event) { @@ -711,7 +707,7 @@ public class ServerManager extends MiniPlugin while (blocks < 10 && (bottomVector.getBlockX() != topVector.getBlockX() || bottomVector.getBlockZ() != topVector.getBlockZ())) { - _serverPortalLocations.put(new Vector(bottomVector.getBlockX(), bottomVector.getBlockY(), bottomVector.getBlockZ()), serverGroup.getServerNpcName()); + _portalToServerKey.put(new Vector(bottomVector.getBlockX(), bottomVector.getBlockY(), bottomVector.getBlockZ()), serverGroup.getPrefix()); if (bottomVector.getBlockX() != topVector.getBlockX()) { @@ -725,7 +721,7 @@ public class ServerManager extends MiniPlugin blocks++; } - _serverPortalLocations.put(bottomVector, serverGroup.getServerNpcName()); + _portalToServerKey.put(bottomVector, serverGroup.getPrefix()); } } }