From 7385478e133e1659bdd9bd182d2f1152d66a81fe Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Thu, 29 Aug 2013 14:20:57 +0200 Subject: [PATCH] Small-Improvements - Better .command-Permission documentation - JUKEBOX blocked by default - ignoreCancelled PlayerInteractEvent --- .../jaschastarke/minecraft/limitedcreative/Permissions.java | 5 +++-- .../minecraft/limitedcreative/limits/LimitConfig.java | 2 ++ .../minecraft/limitedcreative/limits/PlayerListener.java | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/Permissions.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/Permissions.java index cf72914..d6033ee 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/Permissions.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/Permissions.java @@ -37,8 +37,9 @@ public class Permissions extends SimplePermissionContainerNode { */ public static final IPermission CONFIG = new BasicPermission(CONTAINER, "config", PermissionDefault.OP); /** - * Gives player access to the general /limitedcreative command. This permission doesn't affect the usability, but - * allows to hide the command from /help for users. + * Needed for any player that want's to use the /lc or /limitedcreative-command. If not granted, the user shouldn't + * see the command in /help, but he also isn't able to use the /lc c-gamemode commands, even if switch_gamemode + * is granted. */ public static final IPermission COMMAND = new BasicPermission(CONTAINER, "command", PermissionDefault.OP); } diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/LimitConfig.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/LimitConfig.java index 9e6c37b..197694d 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/LimitConfig.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/LimitConfig.java @@ -179,6 +179,7 @@ public class LimitConfig extends Configuration implements IConfigurationSubGroup * - LEVER * - STONE_BUTTON * - WOOD_BUTTON + * - JUKEBOX */ @IsConfigurationNode(name = "interact", order = 600) public BlackList getBlockInteraction() { @@ -190,6 +191,7 @@ public class LimitConfig extends Configuration implements IConfigurationSubGroup interactList.add(new BlackList.Blacklisted(Material.LEVER)); interactList.add(new BlackList.Blacklisted(Material.STONE_BUTTON)); interactList.add(new BlackList.Blacklisted(Material.WOOD_BUTTON)); + interactList.add(new BlackList.Blacklisted(Material.JUKEBOX)); } } return interactList; diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java index 97c796d..13efa1c 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/limits/PlayerListener.java @@ -64,7 +64,7 @@ public class PlayerListener implements Listener { * @return The relevant "isCancelled" */ public static boolean isCancelled(PlayerInteractEvent event) { - return event.useInteractedBlock() == Event.Result.DENY && event.useItemInHand() == Event.Result.DENY; + return event.isCancelled() || (event.useInteractedBlock() == Event.Result.DENY && event.useItemInHand() == Event.Result.DENY); } @EventHandler @@ -160,7 +160,7 @@ public class PlayerListener implements Listener { } } - @EventHandler + @EventHandler(ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { if (!isCancelled(event) && event.getPlayer().getGameMode() == GameMode.CREATIVE) { if (event.getItem() != null && mod.getConfig().getBlockUse().isListed(event.getItem())) {