mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-12 11:21:34 +01:00
Added check if player eats something
This commit is contained in:
parent
59a1726e8c
commit
916ed2652e
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user