mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-08 01:17:41 +01:00
Support for new trial spawners protection
This commit is contained in:
parent
2733e31535
commit
2d9bbb9cc1
@ -21,6 +21,8 @@ import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||||
|
|
||||||
|
import com.google.common.base.Enums;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.flags.FlagListener;
|
import world.bentobox.bentobox.api.flags.FlagListener;
|
||||||
import world.bentobox.bentobox.lists.Flags;
|
import world.bentobox.bentobox.lists.Flags;
|
||||||
|
|
||||||
@ -101,6 +103,10 @@ public class BreakBlocksListener extends FlagListener {
|
|||||||
{
|
{
|
||||||
return;
|
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)
|
switch (m)
|
||||||
{
|
{
|
||||||
case CAKE -> this.checkIsland(e, p, l, Flags.BREAK_BLOCKS);
|
case CAKE -> this.checkIsland(e, p, l, Flags.BREAK_BLOCKS);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package world.bentobox.bentobox.listeners.flags.worldsettings;
|
package world.bentobox.bentobox.listeners.flags.worldsettings;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
@ -21,8 +20,8 @@ public class SpawnerSpawnEggsListener extends FlagListener {
|
|||||||
public void onSpawnerChange(final PlayerInteractEvent e) {
|
public void onSpawnerChange(final PlayerInteractEvent e) {
|
||||||
User user = User.getInstance(e.getPlayer());
|
User user = User.getInstance(e.getPlayer());
|
||||||
// Checking if the clicked block is a spawner and the item in hand is a mob egg
|
// 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)
|
if (e.getClickedBlock() != null && e.getClickedBlock().getType().name().endsWith("_SPAWNER")
|
||||||
&& e.getItem() != null && e.getItem().getType().toString().endsWith("_SPAWN_EGG")
|
&& e.getItem() != null && e.getItem().getType().name().endsWith("_SPAWN_EGG")
|
||||||
&& getIWM().inWorld(e.getClickedBlock().getWorld())
|
&& 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.bypass." + Flags.SPAWNER_SPAWN_EGGS.getID() + ".everywhere")
|
||||||
|| user.hasPermission(getIWM().getPermissionPrefix(e.getClickedBlock().getWorld()) + "mod.bypassprotect"))
|
|| user.hasPermission(getIWM().getPermissionPrefix(e.getClickedBlock().getWorld()) + "mod.bypassprotect"))
|
||||||
|
Loading…
Reference in New Issue
Block a user