diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-09-19 19:47:14 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-09-19 19:47:47 +0100 |
commit | 9b21ee55c2b006ec7389b7b2f89b1c2df4a1938c (patch) | |
tree | 1be3e8c7fc579d56f0df8cdf19a452424acf0805 /EssentialsAntiBuild/src/com/earth2me | |
parent | c93fcceade4316d76d78494597c1d98e999d4dbd (diff) | |
download | Essentials-9b21ee55c2b006ec7389b7b2f89b1c2df4a1938c.tar Essentials-9b21ee55c2b006ec7389b7b2f89b1c2df4a1938c.tar.gz Essentials-9b21ee55c2b006ec7389b7b2f89b1c2df4a1938c.tar.lz Essentials-9b21ee55c2b006ec7389b7b2f89b1c2df4a1938c.tar.xz Essentials-9b21ee55c2b006ec7389b7b2f89b1c2df4a1938c.zip |
New Permission:
essentials.build.craft.<id>[:<datavalue>] - Allows crafting of an item
Diffstat (limited to 'EssentialsAntiBuild/src/com/earth2me')
-rw-r--r-- | EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index a877bc47e..a58ffa04e 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -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())); + } + } + } + } } |