Small-Improvements
- Better .command-Permission documentation - JUKEBOX blocked by default - ignoreCancelled PlayerInteractEvent
This commit is contained in:
parent
b32b0109f0
commit
7385478e13
3 changed files with 7 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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())) {
|
||||
|
|
Loading…
Reference in a new issue