diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/newui/ServerSelectionPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/newui/ServerSelectionPage.java index d749d9e86..32bf57020 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/newui/ServerSelectionPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/newui/ServerSelectionPage.java @@ -1,7 +1,9 @@ package mineplex.hub.server.newui; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.concurrent.TimeUnit; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -11,6 +13,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; import mineplex.core.game.status.GameInfo; import mineplex.core.game.status.GameInfo.GameDisplayStatus; @@ -26,9 +29,14 @@ public class ServerSelectionPage extends ShopPageBase GAME_SERVER_SORTER = (o1, o2) -> + { + return 0; + }; private final ServerGroup _serverGroup; + private final long _openedAt; private boolean _showInProgress; @@ -37,24 +45,41 @@ public class ServerSelectionPage extends ShopPageBase servers = new ArrayList<>(getPlugin().getServers(_serverGroup.getPrefix())); + servers.sort(GAME_SERVER_SORTER); + if (_showInProgress) { // TODO MAKE } else { - buildMainPage(); + buildMainPage(servers); } } - private void buildMainPage() + private void buildMainPage(List servers) { + // Filter servers + servers.removeIf(server -> + { + GameDisplayStatus status = server.getInfo().getStatus(); + return status == null || status == GameDisplayStatus.IN_PROGRESS || status == GameDisplayStatus.CLOSING; + }); + // Instant join addRow(0, (byte) 3, new ItemBuilder(Material.DIAMOND_BLOCK) .setTitle(C.cGreenB + "Click To Join Instantly!") @@ -65,7 +90,6 @@ public class ServerSelectionPage extends ShopPageBase servers = new ArrayList<>(getPlugin().getServers(_serverGroup.getPrefix())); int slot = STARTING_SLOT; for (GameServer server : servers) @@ -96,7 +120,8 @@ public class ServerSelectionPage extends ShopPageBase { - // TODO show in progress servers + _showInProgress = !_showInProgress; + refresh(); }); } @@ -136,7 +161,7 @@ public class ServerSelectionPage extends ShopPageBase