From 757e502b14ca26a042fc92534c670652af00aaa9 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Sat, 18 Jul 2015 10:26:55 +0200 Subject: [PATCH] Fixes #373 --- .../java/com/intellectualcrafters/plot/config/C.java | 2 ++ .../plot/listeners/PlotListener.java | 10 +++++++++- src/main/resources/plugin.yml | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/config/C.java b/src/main/java/com/intellectualcrafters/plot/config/C.java index 43c07a10a..775d2479f 100644 --- a/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -104,6 +104,8 @@ public enum C { WORLDEDIT_BYPASS("$2&oTo bypass your restrictions use $4/plot wea", "WorldEdit Masks"), WORLDEDIT_UNMASKED("$1Your WorldEdit is now unrestricted.", "WorldEdit Masks"), WORLDEDIT_RESTRICTED("$1Your WorldEdit is now restricted.", "WorldEdit Masks"), + + GAMEMODE_WAS_BYPASSED("$1You bypassed the gamemode ($2{gamemode}) $1set for this plot", "Gamemode"), /* * Records */ diff --git a/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java index 1d7041b7c..e419dba38 100644 --- a/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java +++ b/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java @@ -133,7 +133,15 @@ public class PlotListener extends APlotListener { final Flag gamemodeFlag = flags.get("gamemode"); if (gamemodeFlag != null) { - player.setGameMode(getGameMode(gamemodeFlag.getValueString())); + if (!player.hasPermission("plots.gamemode.bypass")) { + player.setGameMode(getGameMode(gamemodeFlag.getValueString())); + } else { + MainUtil.sendMessage( + pp, + C.GAMEMODE_WAS_BYPASSED.s().replace("{plot}", plot.getId().toString()).replace("{gamemode}", gamemodeFlag.getValueString()), + true + ); + } } final Flag flyFlag = flags.get("fly"); if (flyFlag != null) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 9cee46022..dafe6edc9 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -123,4 +123,6 @@ permissions: plots.undeny: true plots.kick: true plots.worldedit.bypass: - default: false \ No newline at end of file + default: false + plots.gamemode.bypass: + default: op \ No newline at end of file