From f0e6e853a631a585e778acc68d070d6c6aa4fe73 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Tue, 20 Nov 2012 09:09:16 +0100 Subject: [PATCH] v1.4.0b: - Fix: CmdBlocker not active in survival mode --- plugin.yml | 2 +- pom.xml | 2 +- .../cmdblock/CommandBlocker.java | 25 +++++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/plugin.yml b/plugin.yml index e21f593..16d6cff 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: LimitedCreative main: de.jaschastarke.minecraft.limitedcreative.Core -version: 1.4.0a +version: 1.4.0b softdepend: [WorldGuard, WorldEdit, MultiInv] dev-url: http://dev.bukkit.org/server-mods/limited-creative/ commands: diff --git a/pom.xml b/pom.xml index a1c06d0..5d20281 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ de.jaschastarke LimitedCreative LimitedCreative - 1.4.0a + 1.4.0b https://github.com/possi/LimitedCreative scm:git:git://github.com/possi/LimitedCreative.git diff --git a/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java b/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java index 3c90e3b..5cc0986 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/cmdblock/CommandBlocker.java @@ -2,6 +2,7 @@ package de.jaschastarke.minecraft.limitedcreative.cmdblock; import static de.jaschastarke.minecraft.utils.Locale.L; +import org.bukkit.GameMode; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -22,17 +23,19 @@ public class CommandBlocker { class Listener implements org.bukkit.event.Listener { @EventHandler public void onPreCommand(PlayerCommandPreprocessEvent event) { - String cmd = event.getMessage(); - if (cmd.startsWith("/")) { // just to be sure ;) - cmd = cmd.substring(1); - for (ICmdBlockEntry blockentry : plugin.config.getCommandBlockList()) { - if (blockentry.test(cmd)) { - LCPlayer player = Players.get(event.getPlayer()); - if (!player.hasPermission(Perms.CmdBlock.ALL)) { - Core.debug("CmdBlock: "+event.getPlayer().getName()+": '/"+cmd+"' blocked by rule '"+blockentry.toString()+"'"); - event.setCancelled(true); - event.getPlayer().sendMessage(L("cmdblock.blocked")); - return; + if (event.getPlayer().getGameMode() == GameMode.CREATIVE) { + String cmd = event.getMessage(); + if (cmd.startsWith("/")) { // just to be sure ;) + cmd = cmd.substring(1); + for (ICmdBlockEntry blockentry : plugin.config.getCommandBlockList()) { + if (blockentry.test(cmd)) { + LCPlayer player = Players.get(event.getPlayer()); + if (!player.hasPermission(Perms.CmdBlock.ALL)) { + Core.debug("CmdBlock: "+event.getPlayer().getName()+": '/"+cmd+"' blocked by rule '"+blockentry.toString()+"'"); + event.setCancelled(true); + event.getPlayer().sendMessage(L("cmdblock.blocked")); + return; + } } } }