Added check if player eats something

This commit is contained in:
DarkLiKally 2011-03-01 19:43:50 +01:00
parent 59a1726e8c
commit 916ed2652e
2 changed files with 14 additions and 0 deletions

View File

@ -28,6 +28,8 @@
import com.sk89q.worldguard.protection.regionmanager.RegionManager;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.ChatColor;

View File

@ -18,6 +18,8 @@
*/
package com.sk89q.worldguard.bukkit;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginManager;
@ -133,10 +135,20 @@ public void onPlayerItem(PlayerItemEvent event) {
Player player = event.getPlayer();
Block block = event.getBlockClicked();
ItemStack item = event.getItem();
int itemId = item.getTypeId();
WorldGuardConfiguration cfg = plugin.getWgConfiguration();
WorldGuardWorldConfiguration wcfg = cfg.getWorldConfig(player.getWorld().getName());
Material type = block.getType();
if (wcfg.useRegions && type != Material.LEVER && type != Material.STONE_BUTTON && type != Material.DIODE
&& (itemId == 322 || itemId == 320 || itemId == 319 || itemId == 297 || itemId == 260
|| itemId == 350 || itemId == 349 || itemId == 354) ) {
return;
}
if (!wcfg.itemDurability) {
// Hoes
if (item.getTypeId() >= 290 && item.getTypeId() <= 294) {