Added itemDropBlacklist

This commit is contained in:
Sturmeh 2010-11-18 16:40:43 +11:00
parent a7aed1a278
commit 2562502d26
2 changed files with 25 additions and 0 deletions

View File

@ -61,6 +61,8 @@ public void initialize() {
PluginListener.Priority.HIGH);
loader.addListener(PluginLoader.Hook.DISCONNECT, listener, this,
PluginListener.Priority.HIGH);
loader.addListener(PluginLoader.Hook.ITEM_DROP , listener, this,
PluginListener.Priority.HIGH);
}
/**

View File

@ -67,6 +67,7 @@ public class WorldGuardListener extends PluginListener {
private boolean blockLagFix;
private Set<Integer> fireNoSpreadBlocks;
private Set<Integer> allowedLavaSpreadOver;
private Set<Integer> itemDropBlacklist;
private boolean classicWater;
private Map<Integer,BlacklistEntry> blacklist;
@ -113,6 +114,7 @@ public void loadConfiguration() {
blockLighter = properties.getBoolean("block-lighter", false);
preventLavaFire = properties.getBoolean("disable-lava-fire", false);
disableAllFire = properties.getBoolean("disable-all-fire-spread", false);
itemDropBlacklist = toBlockIDSet(properties.getString("item-drop-blacklist", ""));
fireNoSpreadBlocks = toBlockIDSet(properties.getString("disallowed-fire-spread-blocks", ""));
allowedLavaSpreadOver = toBlockIDSet(properties.getString("allowed-lava-spread-blocks", ""));
classicWater = properties.getBoolean("classic-water", false);
@ -175,6 +177,27 @@ public String onLoginChecks(String user) {
return null;
}
/**
* Called when a player drops an item.
*
* @param player
* player who dropped the item
* @param item
* item that was dropped
* @return true if you don't want the dropped item to be spawned in the
* world
*/
public boolean onItemDrop(Player player, Item item) {
if (itemDropBlacklist.isEmpty()) return false;
int n = item.getItemId();
if (itemDropBlacklist.contains(n)) {
player.sendMessage(Colors.Rose+"Item was destroyed!");
return true;
}
return false;
}
/**
* Called when someone presses right click. If they right clicked with a