mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
New Permission:
essentials.build.craft.<id>[:<datavalue>] - Allows crafting of an item
This commit is contained in:
parent
e6aeefb12d
commit
a79b76e8d2
@ -7,11 +7,13 @@ import java.util.logging.Level;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -230,4 +232,25 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onCraftItemEvent(final CraftItemEvent event)
|
||||
{
|
||||
HumanEntity entity = event.getWhoClicked();
|
||||
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
final User user = ess.getUser(entity);
|
||||
final ItemStack item = event.getRecipe().getResult();
|
||||
|
||||
if (!metaPermCheck(user, "craft", item.getTypeId(), item.getData().getData()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
if (ess.getSettings().warnOnBuildDisallow())
|
||||
{
|
||||
user.sendMessage(_("antiBuildUse", item.getType().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user