diff --git a/core/src/main/java/dev/nandi0813/practice/manager/inventory/InventoryListener.java b/core/src/main/java/dev/nandi0813/practice/manager/inventory/InventoryListener.java index 9363e698..6f12ebf5 100644 --- a/core/src/main/java/dev/nandi0813/practice/manager/inventory/InventoryListener.java +++ b/core/src/main/java/dev/nandi0813/practice/manager/inventory/InventoryListener.java @@ -118,26 +118,31 @@ public void onPlayerInteractWithInvItem(PlayerInteractEvent e) { @EventHandler public void onLobbyInteractProtection(PlayerInteractEvent e) { Player player = e.getPlayer(); - if (!isInLobbyWorld(player) || player.hasPermission("zpp.admin")) { - return; - } + Profile profile = ProfileManager.getInstance().getProfile(player); + ProfileStatus profileStatus = profile.getStatus(); - Block clickedBlock = e.getClickedBlock(); - if (clickedBlock == null) { - return; - } + if (isLobbyStatus(profileStatus)) { + if (!isLobbyProtectionAllowed("allow-lobby-interact") + && !player.hasPermission("zpp.admin")) { - Action action = e.getAction(); - Material type = clickedBlock.getType(); + Block clickedBlock = e.getClickedBlock(); + if (clickedBlock == null) return; - if (action == Action.PHYSICAL && Tag.PRESSURE_PLATES.isTagged(type)) { - e.setCancelled(true); - return; - } + Action action = e.getAction(); + Material type = clickedBlock.getType(); - if ((action == Action.RIGHT_CLICK_BLOCK || action == Action.LEFT_CLICK_BLOCK) - && (Tag.TRAPDOORS.isTagged(type) || isProtectedWorkstation(type))) { - e.setCancelled(true); + if (action == Action.PHYSICAL && Tag.PRESSURE_PLATES.isTagged(type)) { + e.setCancelled(true); + return; + } + + if ((action == Action.RIGHT_CLICK_BLOCK || action == Action.LEFT_CLICK_BLOCK) + && (Tag.TRAPDOORS.isTagged(type) || isProtectedWorkstation(type))) { + e.setCancelled(true); + } + } + + return; } } diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index 74c968ab..c2c60201 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -1,4 +1,4 @@ -VERSION: 57 +VERSION: 58 # Mysql database setup. MYSQL-DATABASE: @@ -656,6 +656,7 @@ PLAYER: allow-hunger: false allow-block-break: false allow-block-place: false + allow-lobby-interact: false LOBBY-NAMETAG: ENABLED: true NAMETAG-MANAGEMENT: