Fix Clans selection not working

This commit is contained in:
Sam 2018-08-21 01:48:19 +01:00 committed by Alexander Meech
parent 33e6bdc4f7
commit d931f38b18

View File

@ -261,7 +261,7 @@ public class ServerManager extends MiniPlugin
if (npcName.contains("Clans"))
{
ServerGroup serverGroup = _serverGroupsByName.get("Clans");
ServerGroup serverGroup = _serverGroupsByName.get("ClansHub");
if (serverGroup == null)
{
@ -269,7 +269,7 @@ public class ServerManager extends MiniPlugin
return;
}
if (!selectBest(player, serverGroup))
if (!selectBest(player, serverGroup, false))
{
player.sendMessage(F.main(getName(), "Sorry I was unable to find you a good server to send you to."));
}
@ -490,6 +490,11 @@ public class ServerManager extends MiniPlugin
}
public boolean selectBest(Player player, ServerGroup serverGroup)
{
return selectBest(player, serverGroup, true);
}
public boolean selectBest(Player player, ServerGroup serverGroup, boolean checkValid)
{
if (!Recharge.Instance.use(player, "Select Best Server", SELECT_SERVER_COOLDOWN, false, false))
{
@ -499,6 +504,8 @@ public class ServerManager extends MiniPlugin
Collection<GameServer> servers = getServers(serverGroup.getPrefix());
int required = getRequiredSlots(player);
if (checkValid)
{
servers.removeIf(server ->
{
MinecraftServer serverStatus = server.getServer();
@ -521,6 +528,7 @@ public class ServerManager extends MiniPlugin
return true;
}
});
}
if (servers.isEmpty())
{