Merge branch 'master' of https://github.com/Sturmeh/worldguard into Worldguard.

This commit is contained in:
sk89q 2010-11-19 02:12:11 -08:00
commit 47a4046d47
2 changed files with 26 additions and 0 deletions

View File

@ -67,6 +67,8 @@ public class WorldGuard extends Plugin {
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

@ -77,6 +77,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;
@ -132,6 +133,7 @@ public class WorldGuardListener extends PluginListener {
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);
@ -213,6 +215,28 @@ public class WorldGuardListener extends PluginListener {
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 != null) {
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