Add enderchest, bed and dispenser permissions in addition to bypass node; resolves #417

Co-Authored-By: LogoCat <kuohsuanlo@users.noreply.github.com>
This commit is contained in:
Daniel Saukel 2019-02-17 16:03:10 +01:00
parent 887e0c9af1
commit 4922803bd9
2 changed files with 6 additions and 3 deletions

View File

@ -32,6 +32,7 @@ import static org.bukkit.permissions.PermissionDefault.*;
public enum DPermission {
// Main nodes
BED("bed", OP),
BREAK("break", OP),
BYPASS("bypass", OP),
CHAT("chat", TRUE),
@ -41,6 +42,8 @@ public enum DPermission {
DELETE("delete", OP),
DUNGEON_ITEM("dungeonitem", OP),
EDIT("edit", OP),
ENDER_CHEST("enderchest", OP),
DISPENSER("dispenser", OP),
ENTER("enter", OP),
ESCAPE("escape", TRUE),
GAME("game", TRUE),

View File

@ -536,13 +536,13 @@ public class DPlayerListener implements Listener {
if (dGameWorld != null || DEditWorld.getByWorld(player.getWorld()) != null) {
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
if (VanillaItem.ENDER_CHEST.is(clickedBlock)) {
if (!DPermission.hasPermission(player, DPermission.BYPASS)) {
if (!DPermission.hasPermission(player, DPermission.BYPASS) && !DPermission.hasPermission(player, DPermission.ENDER_CHEST)) {
MessageUtil.sendMessage(player, DMessage.ERROR_ENDERCHEST.getMessage());
event.setCancelled(true);
}
} else if (Category.BEDS.containsBlock(clickedBlock)) {
if (!DPermission.hasPermission(player, DPermission.BYPASS)) {
if (!DPermission.hasPermission(player, DPermission.BYPASS) && !DPermission.hasPermission(player, DPermission.BED)) {
MessageUtil.sendMessage(player, DMessage.ERROR_BED.getMessage());
event.setCancelled(true);
}
@ -554,7 +554,7 @@ public class DPlayerListener implements Listener {
if (dGameWorld != null) {
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
if (VanillaItem.DISPENSER.is(clickedBlock)) {
if (!DPermission.hasPermission(player, DPermission.BYPASS)) {
if (!DPermission.hasPermission(player, DPermission.BYPASS) && !DPermission.hasPermission(player, DPermission.DISPENSER)) {
MessageUtil.sendMessage(player, DMessage.ERROR_DISPENSER.getMessage());
event.setCancelled(true);
}