- Fix: CmdBlocker not active in survival mode
This commit is contained in:
Jascha Starke 2012-11-20 09:09:16 +01:00
parent 251de6aa5c
commit f0e6e853a6
3 changed files with 16 additions and 13 deletions

View file

@ -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:

View file

@ -3,7 +3,7 @@
<groupId>de.jaschastarke</groupId>
<artifactId>LimitedCreative</artifactId>
<name>LimitedCreative</name>
<version>1.4.0a</version>
<version>1.4.0b</version>
<url>https://github.com/possi/LimitedCreative</url>
<scm>
<connection>scm:git:git://github.com/possi/LimitedCreative.git</connection>

View file

@ -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;
}
}
}
}