Place players on correct server corresponding to their rank via portals

This commit is contained in:
Shaun Bennett 2014-07-31 23:56:51 -05:00
parent 7d1da7114f
commit c01e9abf29

View File

@ -1,8 +1,17 @@
package mineplex.hub.server;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.time.Duration;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -22,7 +31,14 @@ import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory;
@ -146,11 +162,16 @@ public class ServerManager extends MiniPlugin
try
{
Collections.sort(serverList, new ServerSorter(slots));
boolean hasUltra = _clientManager.Get(player).GetRank().Has(Rank.ULTRA);
for (ServerInfo serverInfo : serverList)
{
if ((serverInfo.MOTD.contains("Starting") || serverInfo.MOTD.contains("Recruiting") || serverInfo.MOTD.contains("Waiting") || serverInfo.MOTD.contains("Cup")) && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slots)
{
// Make sure ultra players get put on premium servers, non premium gets placed on free servers
if (hasUltra == serverInfo.isFree())
continue;
SelectServer(player, serverInfo);
return;
}