From 6f2a9929c08ae480e48937570dea9aefb33af635 Mon Sep 17 00:00:00 2001 From: BONNe Date: Sun, 5 Jun 2022 21:52:37 +0300 Subject: [PATCH] Fixes Glowing Item frames protection (#1985) * Fixes glowing item frame protection. Glowing item frames were not protected. Fixes #475 * Fixes check-style. --- .../listeners/flags/protection/BlockInteractionListener.java | 1 + .../listeners/flags/protection/PlaceBlocksListener.java | 2 +- .../flags/protection/BlockInteractionListenerTest.java | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java index 55deac57e..154fcfee3 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java @@ -198,6 +198,7 @@ public class BlockInteractionListener extends FlagListener { case END_PORTAL_FRAME: checkIsland(e, player, loc, Flags.PLACE_BLOCKS); break; + case GLOW_ITEM_FRAME: case ITEM_FRAME: checkIsland(e, player, loc, Flags.ITEM_FRAME); break; diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/PlaceBlocksListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/PlaceBlocksListener.java index 703e11bcd..1ca9758e9 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/PlaceBlocksListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/PlaceBlocksListener.java @@ -52,7 +52,7 @@ public class PlaceBlocksListener extends FlagListener { */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerHitItemFrame(PlayerInteractEntityEvent e) { - if (e.getRightClicked().getType().equals(EntityType.ITEM_FRAME)) { + if (e.getRightClicked().getType().equals(EntityType.ITEM_FRAME) || e.getRightClicked().getType().equals(EntityType.GLOW_ITEM_FRAME)) { if (!checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.PLACE_BLOCKS)) return; checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.ITEM_FRAME); } diff --git a/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListenerTest.java b/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListenerTest.java index 8c722f717..fb2bd2e9f 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListenerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListenerTest.java @@ -110,6 +110,7 @@ public class BlockInteractionListenerTest extends AbstractCommonSetup { clickedBlocks.put(Material.DRAGON_EGG, Flags.DRAGON_EGG); clickedBlocks.put(Material.END_PORTAL_FRAME, Flags.PLACE_BLOCKS); clickedBlocks.put(Material.ITEM_FRAME, Flags.ITEM_FRAME); + clickedBlocks.put(Material.GLOW_ITEM_FRAME, Flags.ITEM_FRAME); clickedBlocks.put(Material.SWEET_BERRY_BUSH, Flags.BREAK_BLOCKS); clickedBlocks.put(Material.CAKE, Flags.CAKE); clickedBlocks.put(Material.BEEHIVE, Flags.HIVE);