diff --git a/plugin.yml b/plugin.yml index 8fd1a33..a0c8ee5 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: ManagerXL -version: 0.1 +version: 0.3 main: com.dre.managerxl.P authors: [Frank Baumann, Tobias Schmitz, Joscha Schmitz] softdepend: [Vault] diff --git a/src/com/dre/managerxl/MPlayer.java b/src/com/dre/managerxl/MPlayer.java index 3ed0b5a..15e7ba8 100644 --- a/src/com/dre/managerxl/MPlayer.java +++ b/src/com/dre/managerxl/MPlayer.java @@ -157,7 +157,7 @@ public static boolean LoadAsYml(File file) { mPlayer.setMuted(ymlFile.getBoolean(uuid + ".isMuted")); /* GameMode */ - mPlayer.setGameMode(GameMode.valueOf(ymlFile.getString(uuid + ".GameMode"))); + mPlayer.setGameMode(GameMode.valueOf(ymlFile.getString(uuid + ".GameMode")), false); /* Location */ if (ymlFile.contains(uuid + ".home")) { @@ -262,13 +262,15 @@ public GameMode getGameMode() { return gameMode; } - public boolean setGameMode(GameMode gameMode) { + public boolean setGameMode(GameMode gameMode, boolean msg) { if (gameMode != null) { this.gameMode = gameMode; if (this.getPlayer() != null) { this.getPlayer().setGameMode(this.gameMode); - P.p.msg(this.getPlayer(), P.p.getLanguageReader().get("Player_GameModeChanged", this.gameMode.name())); + if (msg) { + P.p.msg(this.getPlayer(), P.p.getLanguageReader().get("Player_GameModeChanged", this.gameMode.name())); + } } return true; diff --git a/src/com/dre/managerxl/commands/player/CMDGameMode.java b/src/com/dre/managerxl/commands/player/CMDGameMode.java index a254cac..9c322b9 100644 --- a/src/com/dre/managerxl/commands/player/CMDGameMode.java +++ b/src/com/dre/managerxl/commands/player/CMDGameMode.java @@ -29,18 +29,18 @@ public void onExecute(String[] args, CommandSender sender) { if (player.getPlayer() != null) { if (args.length < 1) { if (player.getGameMode() == GameMode.CREATIVE) { - player.setGameMode(GameMode.SURVIVAL); + player.setGameMode(GameMode.SURVIVAL, true); } else { - player.setGameMode(GameMode.CREATIVE); + player.setGameMode(GameMode.CREATIVE, true); } } else { MPlayer targetPlayer = MPlayer.getFromName(args[0]); if (targetPlayer != null) { if (args.length < 2) { if (targetPlayer.getGameMode() == GameMode.CREATIVE) { - targetPlayer.setGameMode(GameMode.SURVIVAL); + targetPlayer.setGameMode(GameMode.SURVIVAL, true); } else { - targetPlayer.setGameMode(GameMode.CREATIVE); + targetPlayer.setGameMode(GameMode.CREATIVE, true); } if (targetPlayer != player) { @@ -66,7 +66,7 @@ public void onExecute(String[] args, CommandSender sender) { if(gm == 2 || gmString.equalsIgnoreCase("adventure")) gameMode = GameMode.ADVENTURE; - if (targetPlayer.setGameMode(gameMode)) { + if (targetPlayer.setGameMode(gameMode, true)) { if (targetPlayer != player) { P.p.msg(sender, P.p.getLanguageReader().get("Player_TargetGameModeChanged", targetPlayer.getGameMode().name(), args[0])); } diff --git a/src/com/dre/managerxl/listeners/PlayerListener.java b/src/com/dre/managerxl/listeners/PlayerListener.java index b80c676..a7eb75d 100644 --- a/src/com/dre/managerxl/listeners/PlayerListener.java +++ b/src/com/dre/managerxl/listeners/PlayerListener.java @@ -44,7 +44,7 @@ public void onPlayerJoin(PlayerJoinEvent event) { MPlayer player = MPlayer.getOrCreate(event.getPlayer().getUniqueId()); player.setOnline(true); - player.setGameMode(player.getGameMode()); + player.setGameMode(player.getGameMode(), false); // Set invisible Players if (!player.isVisible()) {