diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 946c52204..afb3dc39f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -1209,4 +1209,9 @@ public class UtilPlayer { teleportUniform(players, locations, Entity::teleport); } + + public static int getProtocolVersion(Player player) + { + return ((CraftPlayer) player).getHandle().getProtocol(); + } } 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 932a04abf..758344e4a 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 @@ -20,6 +20,7 @@ import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; import org.apache.commons.lang3.tuple.Triple; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -90,6 +91,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; +import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.build.Build; @@ -300,6 +302,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed public boolean DontAllowOverfill = false; + public GameMode PlayerGameMode = GameMode.SURVIVAL; + // Addons public boolean SoupEnabled = true; @@ -1977,6 +1981,12 @@ public abstract class Game extends ListenerComponent implements Lifetimed SetState(GameState.End); } + @EventHandler + public void onTeleportPrepare(PlayerPrepareTeleportEvent event) + { + event.GetPlayer().setGameMode(PlayerGameMode); + } + @EventHandler public void onGameStart(GameStateChangeEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 4e4622674..1cbc0f0a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -228,6 +228,8 @@ public class Build extends Game this.AnticheatDisabled = true; + this.PlayerGameMode = GameMode.CREATIVE; + UtilServer.getServer().spigot().getConfig().set("view-distance", 4); _words = new String[] @@ -316,7 +318,6 @@ public class Build extends Game @EventHandler public void prepare(PlayerPrepareTeleportEvent event) { - event.GetPlayer().setGameMode(GameMode.CREATIVE); event.GetPlayer().setFlying(true); event.GetPlayer().setFlySpeed(0.04f); } 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 785aea5dc..8cb652047 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 @@ -157,6 +157,8 @@ public class Minestrike extends TeamGame this.AllowEntitySpectate = false; this.AllowParticles = false; + + this.PlayerGameMode = GameMode.ADVENTURE; _scoreObj = Scoreboard.getScoreboard().registerNewObjective("HP", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 0c56609f5..9b5150209 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -8,6 +8,7 @@ import java.util.concurrent.TimeUnit; import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -139,6 +140,7 @@ public abstract class SuperSmash extends Game HideTeamSheep = true; ReplaceTeamsWithKits = true; AllowParticles = false; + PlayerGameMode = GameMode.ADVENTURE; manager.GetExplosion().SetRegenerate(true); manager.GetExplosion().setRegenerateTime(TimeUnit.SECONDS.toMillis(30));