mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 11:36:11 +01:00
Added support for fireballs shot by players being blocked by the PVP flag.
This commit is contained in:
parent
b29007275f
commit
41f31250a9
@ -323,13 +323,24 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wcfg.useRegions) {
|
if (wcfg.useRegions) {
|
||||||
|
Fireball fireball = (Fireball) attacker;
|
||||||
Vector pt = toVector(defender.getLocation());
|
Vector pt = toVector(defender.getLocation());
|
||||||
RegionManager mgr = plugin.getGlobalRegionManager().get(player.getWorld());
|
RegionManager mgr = plugin.getGlobalRegionManager().get(player.getWorld());
|
||||||
ApplicableRegionSet set = mgr.getApplicableRegions(pt);
|
ApplicableRegionSet set = mgr.getApplicableRegions(pt);
|
||||||
if (!set.allows(DefaultFlag.GHAST_FIREBALL)) {
|
if (fireball.getShooter() instanceof Player) {
|
||||||
event.setCancelled(true);
|
Vector pt2 = toVector(fireball.getShooter().getLocation());
|
||||||
return;
|
if (!set.allows(DefaultFlag.PVP) || !mgr.getApplicableRegions(pt2).allows(DefaultFlag.PVP)) {
|
||||||
|
((Player) fireball.getShooter()).sendMessage(ChatColor.DARK_RED + "You are in a no-PvP area.");
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!set.allows(DefaultFlag.GHAST_FIREBALL)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user