EnderPearl added
This commit is contained in:
parent
faa47d512d
commit
51fdc38f8c
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user