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);
|
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
|
* Needed for any player that want's to use the /lc or /limitedcreative-command. If not granted, the user shouldn't
|
||||||
* allows to hide the command from /help for users.
|
* 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);
|
public static final IPermission COMMAND = new BasicPermission(CONTAINER, "command", PermissionDefault.OP);
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,6 +179,7 @@ public class LimitConfig extends Configuration implements IConfigurationSubGroup
|
||||||
* - LEVER
|
* - LEVER
|
||||||
* - STONE_BUTTON
|
* - STONE_BUTTON
|
||||||
* - WOOD_BUTTON
|
* - WOOD_BUTTON
|
||||||
|
* - JUKEBOX
|
||||||
*/
|
*/
|
||||||
@IsConfigurationNode(name = "interact", order = 600)
|
@IsConfigurationNode(name = "interact", order = 600)
|
||||||
public BlackList getBlockInteraction() {
|
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.LEVER));
|
||||||
interactList.add(new BlackList.Blacklisted(Material.STONE_BUTTON));
|
interactList.add(new BlackList.Blacklisted(Material.STONE_BUTTON));
|
||||||
interactList.add(new BlackList.Blacklisted(Material.WOOD_BUTTON));
|
interactList.add(new BlackList.Blacklisted(Material.WOOD_BUTTON));
|
||||||
|
interactList.add(new BlackList.Blacklisted(Material.JUKEBOX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return interactList;
|
return interactList;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class PlayerListener implements Listener {
|
||||||
* @return The relevant "isCancelled"
|
* @return The relevant "isCancelled"
|
||||||
*/
|
*/
|
||||||
public static boolean isCancelled(PlayerInteractEvent event) {
|
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
|
@EventHandler
|
||||||
|
@ -160,7 +160,7 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (!isCancelled(event) && event.getPlayer().getGameMode() == GameMode.CREATIVE) {
|
if (!isCancelled(event) && event.getPlayer().getGameMode() == GameMode.CREATIVE) {
|
||||||
if (event.getItem() != null && mod.getConfig().getBlockUse().isListed(event.getItem())) {
|
if (event.getItem() != null && mod.getConfig().getBlockUse().isListed(event.getItem())) {
|
||||||
|
|
Loading…
Reference in a new issue