From 4a7ca75b242c36ad2ff1fe92fa39ecb1b3da887e Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 26 May 2017 18:08:24 -0500 Subject: [PATCH 1/2] Open UFO event for the weekend --- .../common/api/mothership/Mothership.java | 57 ------------------- .../mineplex/hub/modules/AlienInvasion.java | 32 +---------- .../games/alieninvasion/AlienInvasion.java | 11 ---- 3 files changed, 2 insertions(+), 98 deletions(-) delete mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/mothership/Mothership.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/mothership/Mothership.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/mothership/Mothership.java deleted file mode 100644 index 356a7a197..000000000 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/mothership/Mothership.java +++ /dev/null @@ -1,57 +0,0 @@ -package mineplex.core.common.api.mothership; - -import java.util.UUID; - -import org.bukkit.Bukkit; - -import mineplex.core.common.api.ApiHost; -import mineplex.core.common.api.ApiWebCall; -import mineplex.core.common.util.UtilServer; - -public class Mothership -{ - private static final ApiWebCall API_BASE = new ApiWebCall("http://" + ApiHost.getAPIHost("MOTHERSHIP").getHost() + ":" + ApiHost.getAPIHost("MOTHERSHIP").getPort() + "/"); - - public static void addPlayer(UUID uuid, Runnable afterward) - { - UtilServer.runAsync(() -> - { - Boolean response = API_BASE.get("addPlayer/" + uuid.toString(), Boolean.class); - if (response == null) - { - System.out.println("!!! Issue adding player to Mothership server !!!"); - } - UtilServer.runSync(afterward); - }); - } - - public static boolean isWhitelisted(UUID uuid) - { - if (Bukkit.isPrimaryThread()) - { - throw new IllegalStateException("This method MUST NOT be called from the main thread!"); - } - - Boolean response = API_BASE.get("getPlayer/" + uuid.toString(), Boolean.class); - if (response == null) - { - System.out.println("!!! Issue retrieving player whitelist status. Allowing them in anyway! !!!"); - } - return response == null || response; - } - - public static boolean shouldStartEvent() - { - if (Bukkit.isPrimaryThread()) - { - throw new IllegalStateException("This method MUST NOT be called from the main thread"); - } - - Boolean response = API_BASE.get("startEvent/" + UtilServer.getRegion().toString() + "/" + UtilServer.getServerName(), Boolean.class); - if (response == null) - { - System.out.println("!!! Issue checking whether server should start event. Keeping event disabled! !!!"); - } - return response != null && response; - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AlienInvasion.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AlienInvasion.java index 2d510d969..8e022d3fb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AlienInvasion.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/AlienInvasion.java @@ -33,8 +33,6 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.command.CommandBase; import mineplex.core.common.Pair; import mineplex.core.common.Rank; -import mineplex.core.common.api.mothership.Mothership; -import mineplex.core.common.api.mothership.MothershipCommand; import mineplex.core.common.block.schematic.Schematic; import mineplex.core.common.block.schematic.SchematicData; import mineplex.core.common.block.schematic.UtilSchematic; @@ -53,7 +51,6 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilVariant; import mineplex.hub.server.ServerManager; -import mineplex.serverdata.commands.ServerCommandManager; @ReflectivelyCreateMiniPlugin public class AlienInvasion extends MiniPlugin @@ -155,33 +152,8 @@ public class AlienInvasion extends MiniPlugin stopAnimation(); } }); - ServerCommandManager.getInstance().registerCommandType("mothership", MothershipCommand.class, command -> - { - switch (command.getAction()) - { - case START: - runAsync(() -> - { - if (Mothership.shouldStartEvent()) - { - runSync(this::startAnimation); - } - }, 20L); - break; - case CLEANUP: - runSync(this::stopAnimation); - break; - } - }); - - runAsync(() -> - { - if (Mothership.shouldStartEvent()) - { - runSync(this::startAnimation); - } - }); + startAnimation(); } public void startAnimation() @@ -216,7 +188,7 @@ public class AlienInvasion extends MiniPlugin public void sendPlayerToInstance(Player player) { - Mothership.addPlayer(player.getUniqueId(), () -> _serverManager.selectServer(player, "UFO")); + _serverManager.selectServer(player, "UFO"); } public void stopAnimation() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java index 0e3db481e..35739e898 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java @@ -18,13 +18,11 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scoreboard.Team; import mineplex.core.common.Pair; -import mineplex.core.common.api.mothership.Mothership; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -97,15 +95,6 @@ public class AlienInvasion extends SoloGame .register(this); } - @EventHandler - public void onJoin(AsyncPlayerPreLoginEvent event) - { - if (!Mothership.isWhitelisted(event.getUniqueId())) - { - event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_WHITELIST, "You must join by finding a UFO!"); - } - } - @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) From aa271a1bd36087f37dd1161c54ce0fe2579052ad Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 26 May 2017 18:20:27 -0500 Subject: [PATCH 2/2] Enable double XP + gems + shards for the weekend --- .../src/nautilus/game/arcade/game/Game.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 80329fe3f..5ee697db6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -256,7 +256,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed public long PrepareTime = 9000; public boolean PlaySoundGameStart = true; - public double XpMult = 1; + public double XpMult = 2; public boolean SpeedMeasurement = false; @@ -278,7 +278,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed // Gems public boolean CrownsEnabled = false; - public double GemMultiplier = 1; + public double GemMultiplier = 2; public boolean GemHunterEnabled = true; public boolean GemBoosterEnabled = true; public boolean GemDoubleEnabled = true;