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 647de8bc1..318e93d47 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 @@ -255,6 +255,8 @@ public abstract class Game implements Listener public boolean CanAddStats = true; public boolean CanGiveLoot = true; + public boolean VersionRequire1_8 = false; + public ArrayList GemBoosters = new ArrayList(); private final Set> _statTrackers = new HashSet<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index 8d3e0071b..c9d1929e3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -28,6 +28,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.util.Vector; import mineplex.core.common.util.C; @@ -112,6 +113,8 @@ public class Gravity extends SoloGame this.CompassEnabled = true; this.WorldBoundaryKill = false; + + this.VersionRequire1_8 = true; } @Override @@ -706,5 +709,5 @@ public class Gravity extends SoloGame break; } } - } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index 0c7ae915e..c4f5a47ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -260,6 +260,8 @@ public class MineStrike extends TeamGame this.InventoryClick = true; this.JoinInProgress = true; + + this.VersionRequire1_8 = true; _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); @@ -2707,40 +2709,7 @@ public class MineStrike extends TeamGame other.playSound(player.getLocation(), radio.getSound(), 1.5f, 1f); } } - - @EventHandler - public void joinMessage(PlayerJoinEvent event) - { - if (!UtilPlayer.is1_8(event.getPlayer())) - returnToHub(event.getPlayer()); - - else - UtilTextMiddle.display(C.cGold + C.Bold + "MineStrike", "Make sure you accept the Resource Pack", 20, 120, 20, event.getPlayer()); - } - @EventHandler - public void outdatedVersion(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!UtilPlayer.is1_8(player)) - returnToHub(player); - } - } - - public void returnToHub(Player player) - { - UtilPlayer.message(player, " "); - UtilPlayer.message(player, C.cGold + C.Bold + "Mine-Strike requires you to be using Minecraft 1.8!"); - UtilPlayer.message(player, " "); - - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - Manager.GetPortal().sendPlayerToServer(player, "Lobby"); - } - @EventHandler public void debug(PlayerCommandPreprocessEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index dd2016ca5..c08e4f539 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -20,6 +20,7 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; @@ -166,6 +167,7 @@ public class Wizards extends SoloGame DisableKillCommand = false; SoupEnabled = false; DamageTeamSelf = true; + VersionRequire1_8 = true; try { @@ -1030,13 +1032,6 @@ public class Wizards extends SoloGame } } - @EventHandler - public void joinMessage(PlayerJoinEvent event) - { - if (!UtilPlayer.is1_8(event.getPlayer())) - returnToHub(event.getPlayer()); - } - public ItemStack makeBlankWand() { ItemBuilder builder = new ItemBuilder(Material.BLAZE_ROD); @@ -1635,18 +1630,6 @@ public class Wizards extends SoloGame } } - @EventHandler - public void outdatedVersion(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!UtilPlayer.is1_8(player)) - returnToHub(player); - } - } @Override public void ParseData() @@ -1657,16 +1640,6 @@ public class Wizards extends SoloGame System.out.print("Endgame event: " + (_endGameEvent == 0 ? "Meteors" : "Lightning")); } - public void returnToHub(Player player) - { - UtilPlayer.message(player, " "); - UtilPlayer.message(player, C.cGold + C.Bold + "Wizards requires you to be using Minecraft 1.8!"); - UtilPlayer.message(player, " "); - - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - Manager.GetPortal().sendPlayerToServer(player, "Lobby"); - } - @EventHandler public void ScoreboardUpdate(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index a964681ea..05c7703be 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -53,6 +53,7 @@ import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -1127,4 +1128,58 @@ public class GameFlagManager implements Listener event.setCancelled(true); } } + + @EventHandler + public void versionUpdateCheck(UpdateEvent event) + { + if (Manager.GetGame() == null) + return; + + if (!Manager.GetGame().DisableKillCommand) + return; + + if (event.getType() != UpdateType.SEC) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (!UtilPlayer.is1_8(player)) + versionKick(player); + } + } + + @EventHandler + public void versionJoinCheck(PlayerJoinEvent event) + { + if (Manager.GetGame() == null) + return; + + if (!Manager.GetGame().VersionRequire1_8) + return; + + if (!UtilPlayer.is1_8(event.getPlayer())) + versionKick(event.getPlayer()); + } + + public void versionKick(Player player) + { + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cGold + C.Bold + "Gravity requires you to be using Minecraft 1.8!"); + UtilPlayer.message(player, " "); + + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); + Manager.GetPortal().sendPlayerToServer(player, "Lobby"); + } + + @EventHandler + public void resourceInform(PlayerJoinEvent event) + { + if (Manager.GetGame() == null) + return; + + if (Manager.GetGame().GetType().getResourcePackUrl() == null) + return; + + UtilTextMiddle.display(C.cGold + C.Bold + Manager.GetGame().GetType().GetName(), "Make sure you accept the Resource Pack", 20, 120, 20, event.getPlayer()); + } }