diff --git a/src/net/crystalyx/bukkit/simplyperms/SimplyPrevents.java b/src/net/crystalyx/bukkit/simplyperms/SimplyPrevents.java index a405ae2..b8f3573 100755 --- a/src/net/crystalyx/bukkit/simplyperms/SimplyPrevents.java +++ b/src/net/crystalyx/bukkit/simplyperms/SimplyPrevents.java @@ -51,6 +51,7 @@ public abstract class SimplyPrevents implements Listener { "loot.Drop", "loot.Pickup", "projectile.Egg", + "projectile.EnderPearl", "projectile.Potion", "projectile.Snowball", "vehicle.Collision", @@ -83,9 +84,7 @@ public abstract class SimplyPrevents implements Listener { protected boolean prevent(Cancellable event, Player player, String node) { if (node.contains(",")) { for (String subNode : node.split(",")) { - if (prevent(event, player, subNode)) { - return true; - } else if (player.isPermissionSet("permissions.allow." + subNode)) { + if (!prevent(event, player, subNode)) { return false; } } diff --git a/src/net/crystalyx/bukkit/simplyperms/preventions/projectile/EnderPearl.java b/src/net/crystalyx/bukkit/simplyperms/preventions/projectile/EnderPearl.java new file mode 100644 index 0000000..51b880d --- /dev/null +++ b/src/net/crystalyx/bukkit/simplyperms/preventions/projectile/EnderPearl.java @@ -0,0 +1,28 @@ +package net.crystalyx.bukkit.simplyperms.preventions.projectile; + +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import net.crystalyx.bukkit.simplyperms.SimplyPlugin; +import net.crystalyx.bukkit.simplyperms.SimplyPrevents; + +public class EnderPearl extends SimplyPrevents { + + public EnderPearl(SimplyPlugin plugin) { + super(plugin); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void egg(PlayerInteractEvent event) { + if (event.getAction() == Action.RIGHT_CLICK_AIR + || event.getAction() == Action.RIGHT_CLICK_BLOCK) { + if (event.getPlayer().getItemInHand().getType() == Material.ENDER_PEARL) { + prevent(event, event.getPlayer(), "enderpearl,projectile"); + } + } + } + +} diff --git a/src/plugin.yml b/src/plugin.yml index 98a708d..c6d7bc7 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -262,6 +262,7 @@ permissions: permissions.allow.egg: true permissions.allow.potion: true permissions.allow.snowball: true + permissions.allow.enderpearl: true permissions.allow.vehicle: description: Allows the player to use vehicles children: