Fix Clans selection not working
This commit is contained in:
parent
33e6bdc4f7
commit
d931f38b18
@ -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,28 +504,31 @@ public class ServerManager extends MiniPlugin
|
||||
Collection<GameServer> servers = getServers(serverGroup.getPrefix());
|
||||
int required = getRequiredSlots(player);
|
||||
|
||||
servers.removeIf(server ->
|
||||
if (checkValid)
|
||||
{
|
||||
MinecraftServer serverStatus = server.getServer();
|
||||
GameInfo info = server.getInfo();
|
||||
|
||||
if (server.isDevServer() || info.getJoinable() != GameJoinStatus.OPEN || serverStatus.getMaxPlayerCount() - serverStatus.getPlayerCount() <= required)
|
||||
servers.removeIf(server ->
|
||||
{
|
||||
return true;
|
||||
}
|
||||
MinecraftServer serverStatus = server.getServer();
|
||||
GameInfo info = server.getInfo();
|
||||
|
||||
switch (info.getStatus())
|
||||
{
|
||||
case WAITING:
|
||||
case VOTING:
|
||||
return false;
|
||||
case STARTING:
|
||||
// If the game is about to start, ignore it. The player probably won't make it in time.
|
||||
return info.getTimer() < 5;
|
||||
default:
|
||||
if (server.isDevServer() || info.getJoinable() != GameJoinStatus.OPEN || serverStatus.getMaxPlayerCount() - serverStatus.getPlayerCount() <= required)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
switch (info.getStatus())
|
||||
{
|
||||
case WAITING:
|
||||
case VOTING:
|
||||
return false;
|
||||
case STARTING:
|
||||
// If the game is about to start, ignore it. The player probably won't make it in time.
|
||||
return info.getTimer() < 5;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (servers.isEmpty())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user