use of com.sk89q.worldguard.protection.ApplicableRegionSet in project MyPet by xXKeyleXx.
the class WorldGuardCustomFlagsHook method canHurt.
@Override
public boolean canHurt(Player attacker, Player defender) {
try {
Location location = defender.getLocation();
RegionManager mgr = wgPlugin.getRegionManager(location.getWorld());
ApplicableRegionSet set = mgr.getApplicableRegions(location);
StateFlag.State s;
s = set.queryState(wgPlugin.wrapPlayer(defender), WorldGuardHook.DAMAGE_FLAG);
return s == null || s == StateFlag.State.ALLOW;
} catch (Throwable ignored) {
}
return true;
}
use of com.sk89q.worldguard.protection.ApplicableRegionSet in project MyPet by xXKeyleXx.
the class WorldGuardHook method canHurt.
@Override
public boolean canHurt(Player attacker, Player defender) {
try {
Location location = defender.getLocation();
RegionManager mgr = wgp.getRegionManager(location.getWorld());
ApplicableRegionSet set = mgr.getApplicableRegions(location);
StateFlag.State s;
if (customFlags) {
s = set.queryState(wgp.wrapPlayer(defender), DefaultFlag.PVP, DAMAGE_FLAG);
} else {
s = set.queryState(wgp.wrapPlayer(defender), DefaultFlag.PVP);
}
return s == null || s == StateFlag.State.ALLOW;
} catch (Throwable ignored) {
}
return true;
}
use of com.sk89q.worldguard.protection.ApplicableRegionSet in project MyPet by xXKeyleXx.
the class WorldGuardHook method isPetAllowed.
@Override
public boolean isPetAllowed(MyPetPlayer player) {
if (customFlags) {
Player p = player.getPlayer();
RegionManager mgr = wgp.getRegionManager(p.getWorld());
ApplicableRegionSet regions = mgr.getApplicableRegions(p.getLocation());
StateFlag.State s = regions.queryState(null, DENY_FLAG);
return s == null || s == StateFlag.State.ALLOW;
}
return true;
}
use of com.sk89q.worldguard.protection.ApplicableRegionSet in project MyPet by xXKeyleXx.
the class WorldGuardCustomFlagsHook method canHurt.
@Override
public boolean canHurt(Player attacker, Entity defender) {
try {
Location location = defender.getLocation();
RegionManager mgr = wgPlugin.getRegionManager(location.getWorld());
ApplicableRegionSet set = mgr.getApplicableRegions(location);
StateFlag.State s = set.queryState(null, WorldGuardHook.DAMAGE_FLAG);
return s == null || s == StateFlag.State.ALLOW;
} catch (Throwable ignored) {
}
return true;
}
use of com.sk89q.worldguard.protection.ApplicableRegionSet in project MyPet by xXKeyleXx.
the class WorldGuardHook method canHurt.
@Override
public boolean canHurt(Player attacker, Entity defender) {
if (customFlags) {
try {
Location location = defender.getLocation();
RegionManager mgr = wgp.getRegionManager(location.getWorld());
ApplicableRegionSet set = mgr.getApplicableRegions(location);
StateFlag.State s;
if (defender instanceof Animals) {
s = set.queryState(null, DefaultFlag.DAMAGE_ANIMALS, DAMAGE_FLAG);
} else {
s = set.queryState(null, DAMAGE_FLAG);
}
return s == null || s == StateFlag.State.ALLOW;
} catch (Throwable ignored) {
}
}
return true;
}
Aggregations