diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java index b40c99b05..2c13dc5b4 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java @@ -21,6 +21,8 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; +import com.google.common.base.Enums; + import world.bentobox.bentobox.api.flags.FlagListener; import world.bentobox.bentobox.lists.Flags; @@ -101,6 +103,10 @@ public void onPlayerInteract(final PlayerInteractEvent e) { return; } + if (Enums.getIfPresent(Material.class, "TRIAL_SPAWNER").isPresent() && m.equals(Material.TRIAL_SPAWNER)) { + this.checkIsland(e, p, l, Flags.BREAK_SPAWNERS); + return; + } switch (m) { case CAKE -> this.checkIsland(e, p, l, Flags.BREAK_BLOCKS); diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/SpawnerSpawnEggsListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/SpawnerSpawnEggsListener.java index 09c5d2e5c..34a7baac6 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/SpawnerSpawnEggsListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/worldsettings/SpawnerSpawnEggsListener.java @@ -1,6 +1,5 @@ package world.bentobox.bentobox.listeners.flags.worldsettings; -import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractEvent; @@ -21,8 +20,8 @@ public class SpawnerSpawnEggsListener extends FlagListener { public void onSpawnerChange(final PlayerInteractEvent e) { User user = User.getInstance(e.getPlayer()); // Checking if the clicked block is a spawner and the item in hand is a mob egg - if (e.getClickedBlock() != null && e.getClickedBlock().getType().equals(Material.SPAWNER) - && e.getItem() != null && e.getItem().getType().toString().endsWith("_SPAWN_EGG") + if (e.getClickedBlock() != null && e.getClickedBlock().getType().name().endsWith("_SPAWNER") + && e.getItem() != null && e.getItem().getType().name().endsWith("_SPAWN_EGG") && getIWM().inWorld(e.getClickedBlock().getWorld()) && !(user.hasPermission(getIWM().getPermissionPrefix(e.getClickedBlock().getWorld()) + "mod.bypass." + Flags.SPAWNER_SPAWN_EGGS.getID() + ".everywhere") || user.hasPermission(getIWM().getPermissionPrefix(e.getClickedBlock().getWorld()) + "mod.bypassprotect"))