Fixes Glowing Item frames protection (#1985)

* Fixes glowing item frame protection.
Glowing item frames were not protected.

Fixes #475

* Fixes check-style.
This commit is contained in:
BONNe 2022-06-05 21:52:37 +03:00 committed by GitHub
parent aad10ad74f
commit 6f2a9929c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -198,6 +198,7 @@ public class BlockInteractionListener extends FlagListener {
case END_PORTAL_FRAME: case END_PORTAL_FRAME:
checkIsland(e, player, loc, Flags.PLACE_BLOCKS); checkIsland(e, player, loc, Flags.PLACE_BLOCKS);
break; break;
case GLOW_ITEM_FRAME:
case ITEM_FRAME: case ITEM_FRAME:
checkIsland(e, player, loc, Flags.ITEM_FRAME); checkIsland(e, player, loc, Flags.ITEM_FRAME);
break; break;

View File

@ -52,7 +52,7 @@ public class PlaceBlocksListener extends FlagListener {
*/ */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerHitItemFrame(PlayerInteractEntityEvent e) { 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; if (!checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.PLACE_BLOCKS)) return;
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.ITEM_FRAME); checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.ITEM_FRAME);
} }

View File

@ -110,6 +110,7 @@ public class BlockInteractionListenerTest extends AbstractCommonSetup {
clickedBlocks.put(Material.DRAGON_EGG, Flags.DRAGON_EGG); clickedBlocks.put(Material.DRAGON_EGG, Flags.DRAGON_EGG);
clickedBlocks.put(Material.END_PORTAL_FRAME, Flags.PLACE_BLOCKS); clickedBlocks.put(Material.END_PORTAL_FRAME, Flags.PLACE_BLOCKS);
clickedBlocks.put(Material.ITEM_FRAME, Flags.ITEM_FRAME); 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.SWEET_BERRY_BUSH, Flags.BREAK_BLOCKS);
clickedBlocks.put(Material.CAKE, Flags.CAKE); clickedBlocks.put(Material.CAKE, Flags.CAKE);
clickedBlocks.put(Material.BEEHIVE, Flags.HIVE); clickedBlocks.put(Material.BEEHIVE, Flags.HIVE);