use of com.sk89q.worldguard.protection.managers.RegionManager 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.managers.RegionManager 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.managers.RegionManager 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.managers.RegionManager in project MagicPlugin by elBukkit.
the class WorldGuardAPI method getDestructible.
@Nullable
public String getDestructible(Player player, Location location) {
if (location != null && worldGuard != null && customFlags != null) {
RegionManager regionManager = worldGuard.getRegionManager(location.getWorld());
if (regionManager == null) {
return null;
}
ApplicableRegionSet checkSet = regionManager.getApplicableRegions(location);
if (checkSet == null) {
return null;
}
return customFlags.getDestructible(getAssociable(player), checkSet);
}
return null;
}
use of com.sk89q.worldguard.protection.managers.RegionManager in project MagicPlugin by elBukkit.
the class WorldGuardAPI method getReflective.
@Nullable
public String getReflective(Player player, Location location) {
if (location != null && worldGuard != null && customFlags != null) {
RegionManager regionManager = worldGuard.getRegionManager(location.getWorld());
if (regionManager == null) {
return null;
}
ApplicableRegionSet checkSet = regionManager.getApplicableRegions(location);
if (checkSet == null) {
return null;
}
return customFlags.getReflective(getAssociable(player), checkSet);
}
return null;
}
Aggregations