diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java index 07f1f4fd6..688cc034a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java @@ -9,9 +9,4 @@ public class ServerInfo public String Map; public String ServerType; public String Game; - - public boolean isFree() - { - return Name.contains("FREE"); - } } \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 2dd463663..757369b9d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -192,10 +192,6 @@ public class ServerManager extends MiniPlugin { 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; } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index 267cf786e..4fe9c0cbd 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -26,7 +26,6 @@ public class ServerNpcPage extends ShopPageBase im { // Shop Item Messages private static final String MESSAGE_SHOP_URL = ChatColor.RESET + "www.mineplex.com/shop"; - private static final String MESSAGE_REQUIRES_PREMIUM = ChatColor.RESET + C.cRed + "Premium requires " + Rank.ULTRA.GetTag(false, false) + C.cRed + " or " + Rank.HERO.GetTag(false, false); private static final String MESSAGE_BETA_GET_ULTRA = ChatColor.RESET + C.Line + "Get Ultra to join Beta servers!"; private static final String MESSAGE_JOIN = ChatColor.RESET + C.Line + "Click to Join"; private static final String MESSAGE_IN_PROGRESS = ChatColor.RESET + C.Line + "Game in Progress."; @@ -37,8 +36,7 @@ public class ServerNpcPage extends ShopPageBase im private String _serverNpcKey; private boolean _onMainPage = true; - private boolean _freeOnly; - + public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverNpcKey) { super(plugin, shop, clientManager, donationManager, name, player, 54); @@ -76,7 +74,7 @@ public class ServerNpcPage extends ShopPageBase im } else { - buildInProgressServerPage(serverList, _freeOnly, slotsNeeded); + buildInProgressServerPage(serverList, slotsNeeded); } } @@ -99,7 +97,7 @@ public class ServerNpcPage extends ShopPageBase im ChatColor.RESET + "Visit " + C.cGreen + "www.mineplex.com/shop" + C.cWhite + " for Premium!" }, seconds, false, false); - AddItem(20, item); + AddItem(22, item); } private void clearPage() @@ -114,14 +112,13 @@ public class ServerNpcPage extends ShopPageBase im { boolean ownsUltraPackage = DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA); Material status = Material.REDSTONE_BLOCK; - boolean free = serverInfo.isFree(); List lore = new ArrayList(); String inProgress = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? MESSAGE_IN_PROGRESS : MESSAGE_SPECTATE; String wait = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? null : MESSAGE_WAIT; if (isStarting(serverInfo) && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slotsNeeded) - status = free ? Material.EMERALD_BLOCK : Material.DIAMOND_BLOCK; + status = Material.EMERALD_BLOCK; else if (isInProgress(serverInfo)) status = Material.GOLD_BLOCK; @@ -135,10 +132,7 @@ public class ServerNpcPage extends ShopPageBase im lore.add(ChatColor.RESET + C.cYellow + "Players: " + C.cWhite + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers); lore.add(ChatColor.RESET + ""); - - // Only show motd if the player has access - if (free || ownsUltraPackage) - lore.add(ChatColor.RESET + serverInfo.MOTD); + lore.add(ChatColor.RESET + serverInfo.MOTD); if (serverInfo.Name.contains("BETA") && !ownsUltraPackage) { @@ -164,13 +158,7 @@ public class ServerNpcPage extends ShopPageBase im { if (!ownsUltraPackage) { - if (free) - lore.add(MESSAGE_FULL_GET_ULTRA); - else - { - lore.add(MESSAGE_REQUIRES_PREMIUM); - lore.add(MESSAGE_SHOP_URL); - } + lore.add(MESSAGE_FULL_GET_ULTRA); } else { @@ -183,8 +171,6 @@ public class ServerNpcPage extends ShopPageBase im } else { - if (free || ownsUltraPackage) - { if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers && !ownsUltraPackage) { lore.add(MESSAGE_FULL_GET_ULTRA); @@ -193,26 +179,17 @@ public class ServerNpcPage extends ShopPageBase im { lore.add(MESSAGE_JOIN); } - } - else - { - lore.add(MESSAGE_REQUIRES_PREMIUM); - lore.add(MESSAGE_SHOP_URL); - } } } - return new ShopItem(status, ChatColor.RESET + C.Line + C.Bold + (free ? C.cGreen + "Free Server " : C.cAqua + "Premium Server ") + serverInfo.Name.split("-")[1], lore.toArray(new String[lore.size()]), serverInfo.CurrentPlayers, false); + return new ShopItem(status, ChatColor.RESET + C.cGreen + C.Line + C.Bold + "Server " + serverInfo.Name.split("-")[1], lore.toArray(new String[lore.size()]), serverInfo.CurrentPlayers, false); } private void buildAvailableServerPage(List serverList, int slotsNeeded) { int greenCount = 0; - int blueCount = 0; - int yellowFreeCount = 0; - int yellowUltraCount = 0; + int yellowCount = 0; int greenStartSlot = 19; - int blueStartSlot = 23; boolean showGreen = true; long portalTime = Plugin.getMillisecondsUntilPortal(Player); @@ -224,73 +201,42 @@ public class ServerNpcPage extends ShopPageBase im for (ServerInfo serverInfo : serverList) { - boolean free = serverInfo.isFree(); - int slot = (free ? greenCount + greenStartSlot : blueCount + blueStartSlot); + int slot = greenCount + greenStartSlot; - if (isStarting(serverInfo) && hasEnoughSlots(serverInfo, slotsNeeded) && (free ? greenCount : blueCount) < 3) + if (isStarting(serverInfo) && hasEnoughSlots(serverInfo, slotsNeeded) && greenCount < 7) { - if ((free && showGreen) || !free) + if (showGreen) { ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded); - if (free) - greenCount++; - else - blueCount++; + greenCount++; AddButton(slot, shopItem, new JoinServerButton(this, serverInfo)); } } else if (isInProgress(serverInfo)) { - if (free) - yellowFreeCount++; - else - yellowUltraCount++; + yellowCount++; } } -// AddItem(11, new ShopItem(Material.IRON_BLOCK, C.cGreen + "Free Servers", new String[] {C.cGray + "Anyone can play!" }, 1, false)); -// AddItem(15, new ShopItem(Material.IRON_BLOCK, C.cBlue + "Premium Servers", new String[] {C.cGray + "Available to " + Rank.ULTRA.GetTag(true, true) + ChatColor.RESET + C.cGray + " and " + Rank.HERO.GetTag(true, true) + ChatColor.RESET + C.cGray + "!" }, 1, false)); - AddButton(38, new ShopItem(Material.GOLD_BLOCK, C.cGreen + yellowFreeCount + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowFreeCount > 64 ? 1 : yellowFreeCount, false), new SingleButton() - { - @Override - public void Clicked(Player player) - { - long portalTime = Plugin.getMillisecondsUntilPortal(Player); - if (portalTime <= 0) - { - _onMainPage = false; - _freeOnly = true; - } - else - { - PlayDenySound(Player); - } - } - }); - AddButton(42, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowUltraCount + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowUltraCount > 64 ? 1 : yellowUltraCount, false), new SingleButton() + AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount++ + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new SingleButton() { @Override public void Clicked(Player player) { _onMainPage = false; - _freeOnly = false; } }); // Clear empty slots if (showGreen) { - for (int i = greenCount + greenStartSlot; i < greenStartSlot + 3; i++) + for (int i = greenCount + greenStartSlot; i < greenStartSlot + 7; i++) { setItem(i, null); } } - for (int i = blueCount + blueStartSlot; i < blueStartSlot + 3; i++) - { - setItem(i, null); - } } private boolean isStarting(ServerInfo serverInfo) @@ -308,13 +254,13 @@ public class ServerNpcPage extends ShopPageBase im return (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slotsNeeded; } - private void buildInProgressServerPage(List serverList, boolean freeOnly, int slotsNeeded) + private void buildInProgressServerPage(List serverList, int slotsNeeded) { int slot = 9; for (ServerInfo serverInfo : serverList) { - if (isInProgress(serverInfo) && serverInfo.isFree() == freeOnly && slot < getSize()) + if (isInProgress(serverInfo) && slot < getSize()) { ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded); @@ -351,7 +297,7 @@ public class ServerNpcPage extends ShopPageBase im { int slots = Plugin.GetRequiredSlots(player, serverInfo.ServerType); - if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (!serverInfo.isFree() && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA)))) + if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA)))) { PlayDenySound(player); return;