New Permission:

essentials.build.pickup.<id>[:<datavalue>] - Allows collecting of an item
essentials.build.drop.<id>[:<datavalue>] - Allows dropping of an item
This commit is contained in:
KHobbits 2012-09-19 20:55:46 +01:00
parent 00e3957190
commit 2a8e44dda8
14 changed files with 63 additions and 1 deletions

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -459,3 +459,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -456,3 +456,5 @@ distance=\u00a76Distance: {0}
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
warpList={0}
uptime=\u00a76Uptime:\u00a7c {0}
antiBuildCraft=\u00a74You are not permitted to create\u00a7c {0}\u00a74.
antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.

View File

@ -15,7 +15,9 @@ 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.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
@ -248,9 +250,43 @@ public class EssentialsAntiBuildListener implements Listener
event.setCancelled(true);
if (ess.getSettings().warnOnBuildDisallow())
{
user.sendMessage(_("antiBuildUse", item.getType().toString()));
user.sendMessage(_("antiBuildCraft", item.getType().toString()));
}
}
}
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
final User user = ess.getUser(event.getPlayer());
final ItemStack item = event.getItem().getItemStack();
if (!metaPermCheck(user, "craft", item.getTypeId(), item.getData().getData()))
{
event.setCancelled(true);
event.getItem().setPickupDelay(50);
}
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerDropItem(PlayerDropItemEvent event)
{
final User user = ess.getUser(event.getPlayer());
final ItemStack item = event.getItemDrop().getItemStack();
if (!metaPermCheck(user, "drop", item.getTypeId(), item.getData().getData()))
{
event.setCancelled(true);
user.updateInventory();
if (ess.getSettings().warnOnBuildDisallow())
{
user.sendMessage(_("antiBuildDrop", item.getType().toString()));
}
}
}
}