diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 1ae93791f..8abc4c36a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -75,6 +75,7 @@ public class ServerManager extends MiniPlugin public enum Perm implements Permission { JOIN_FULL, + JOIN_ALWAYS, FEATURE_SERVER, } @@ -189,6 +190,7 @@ public class ServerManager extends MiniPlugin private void generatePermissions() { PermissionGroup.ULTRA.setPermission(Perm.JOIN_FULL, true, true); + PermissionGroup.TRAINEE.setPermission(Perm.JOIN_ALWAYS, true, true); PermissionGroup.CONTENT.setPermission(Perm.FEATURE_SERVER, true, true); PermissionGroup.BUILDER.setPermission(Perm.FEATURE_SERVER, true, true); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/lobby/LobbyMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/lobby/LobbyMenu.java index 89be1ff96..0708f29c9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/lobby/LobbyMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/lobby/LobbyMenu.java @@ -1,7 +1,6 @@ package mineplex.hub.server.ui.lobby; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import org.bukkit.Material; @@ -34,8 +33,6 @@ public class LobbyMenu extends ShopPageBase boolean ownsUltra = getClientManager().Get(getPlayer()).hasPermission(Perm.JOIN_FULL); String serverName = UtilServer.getServerName(); - servers.sort(Comparator.comparingInt(GameServer::getNumber)); - servers.forEach(server -> { if (server.getNumber() >= getSize()) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/server/ServerSelectionPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/server/ServerSelectionPage.java index f009bbcbf..b1f000130 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/server/ServerSelectionPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/server/ServerSelectionPage.java @@ -308,16 +308,20 @@ public class ServerSelectionPage extends ShopPageBase fakeDeath(event.getPlayer()); } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void vanishStatus(IncognitoStatusChangeEvent event) { if (!event.getNewState()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 9cfd53914..fdcf401b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -273,8 +273,7 @@ public class Bridge extends TeamGame implements OreObsfucation .register(this); _rejoinModule = new RejoinModule(manager) - .setSaveInventory(true) - .setSaveLocation(true); + .setSaveInventory(true); _rejoinModule.register(this); // So that we can be 110% sure diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index b83614949..35ca2f815 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -59,7 +59,6 @@ import nautilus.game.arcade.game.games.draw.tools.ToolCircle; import nautilus.game.arcade.game.games.draw.tools.ToolLine; import nautilus.game.arcade.game.games.draw.tools.ToolSquare; import nautilus.game.arcade.game.modules.compass.CompassModule; -import nautilus.game.arcade.game.modules.rejoin.RejoinModule; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.DrawGuessStatTracker; @@ -263,9 +262,6 @@ public class Draw extends SoloGame new ChatStatData("PureLuck", "Lucky Guesses", true) ); - new RejoinModule(manager) - .register(this); - new CompassModule() .setGiveCompass(true) .setGiveCompassToSpecs(true) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/rejoin/RejoinModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/rejoin/RejoinModule.java index 01559df18..40771a0ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/rejoin/RejoinModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/rejoin/RejoinModule.java @@ -1,13 +1,16 @@ package nautilus.game.arcade.game.modules.rejoin; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.UUID; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.PlayerQuitEvent; @@ -26,13 +29,15 @@ public class RejoinModule extends Module private final GameRejoinManager _manager; private final Map _rejoinData; + private final Set _disallow; - private boolean _saveInventory, _saveLocation; + private boolean _saveInventory; public RejoinModule(ArcadeManager manager) { _manager = new GameRejoinManager(manager); _rejoinData = new HashMap<>(); + _disallow = new HashSet<>(); } @Override @@ -45,6 +50,7 @@ public class RejoinModule extends Module public void cleanup() { _rejoinData.clear(); + _disallow.clear(); UtilServer.Unregister(_manager); } @@ -54,18 +60,23 @@ public class RejoinModule extends Module return this; } - public RejoinModule setSaveLocation(boolean saveLocation) - { - _saveLocation = saveLocation; - return this; - } - public void disableRejoining() { getGame().QuitOut = true; _rejoinData.clear(); } + @EventHandler + public void playerKick(PlayerKickEvent event) + { + if (!isEnabled()) + { + return; + } + + _disallow.add(event.getPlayer()); + } + @EventHandler(priority = EventPriority.LOW) public void playerQuit(PlayerQuitEvent event) { @@ -77,7 +88,7 @@ public class RejoinModule extends Module Player player = event.getPlayer(); GameTeam team = getGame().GetTeam(player); - if (team == null || !team.IsAlive(player) || getGame().QuitOut || player.isDead() || !player.getWorld().equals(getGame().WorldData.World)) + if (team == null || !team.IsAlive(player) || getGame().QuitOut || player.isDead() || _disallow.remove(player) || !player.getWorld().equals(getGame().WorldData.World)) { return; } @@ -95,16 +106,17 @@ public class RejoinModule extends Module _rejoinData.put(player.getUniqueId(), data); - if (_saveLocation) - { - getGame().GetLocationStore().putIfAbsent(player.getName(), player.getLocation()); - } - team.RemovePlayer(player); _manager.saveRejoinData(player, getGame().GetType().getGameId()); } + @EventHandler(priority = EventPriority.MONITOR) + public void playerQuitMonitor(PlayerQuitEvent event) + { + _disallow.remove(event.getPlayer()); + } + @EventHandler(priority = EventPriority.MONITOR) public void playerLogin(PlayerLoginEvent event) { @@ -169,7 +181,7 @@ public class RejoinModule extends Module private boolean isEnabled() { - return !getGame().getArcadeManager().GetGameHostManager().isPrivateServer() && getGame().IsLive(); + return !getGame().getArcadeManager().GetGameHostManager().isPrivateServer() && getGame().InProgress(); } public class PlayerGameInfo