mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-28 05:25:20 +01:00
Protect items in item frames in protected regions.
This commit is contained in:
parent
6b16ed79b3
commit
bbd1a0ef10
@ -33,6 +33,7 @@
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.Fireball;
|
||||||
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
@ -235,6 +236,19 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defender instanceof ItemFrame && wcfg.useRegions) {
|
||||||
|
// bukkit throws this event when a player attempts to remove an item from a frame
|
||||||
|
World world = player.getWorld();
|
||||||
|
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
|
||||||
|
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
|
||||||
|
&& !mgr.getApplicableRegions(defender.getLocation())
|
||||||
|
.canBuild(plugin.wrapPlayer(player))) {
|
||||||
|
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defender instanceof Player) {
|
if (defender instanceof Player) {
|
||||||
|
Loading…
Reference in New Issue
Block a user