Update wghook
This commit is contained in:
parent
c35ae7d630
commit
b114b13902
@ -39,9 +39,8 @@ public class ChairEffects {
|
||||
String pName = p.getName();
|
||||
if (plugin.sit.containsKey(pName)) {
|
||||
if (p.hasPermission("chairs.sit.health")) {
|
||||
double pHealthPcnt = (double) p.getHealth() / (double) p.getMaxHealth() * 100d;
|
||||
if ((pHealthPcnt < plugin.sitMaxHealth)
|
||||
&& (p.getHealth() < p.getMaxHealth())) {
|
||||
double pHealthPcnt = ((double) p.getHealth()) / (double) p.getMaxHealth() * 100d;
|
||||
if ((pHealthPcnt < plugin.sitMaxHealth) && (p.getHealth() < p.getMaxHealth())) {
|
||||
double newHealth = plugin.sitHealthPerInterval + p.getHealth();
|
||||
if (newHealth > p.getMaxHealth()) {
|
||||
newHealth = p.getMaxHealth();
|
||||
|
@ -3,6 +3,7 @@ package com.cnaude.chairs;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitUtil;
|
||||
@ -11,16 +12,23 @@ import com.sk89q.worldguard.bukkit.WGBukkit;
|
||||
public class WGHook {
|
||||
|
||||
public static boolean isAllowedInRegion(HashSet<String> disabledRegions, Location location) {
|
||||
try {
|
||||
if (disabledRegions.isEmpty()) {return true;}
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (disabledRegions.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
List<String> aregions = WGBukkit.getRegionManager(location.getWorld()).getApplicableRegionsIDs(BukkitUtil.toVector(location));
|
||||
for (String region : aregions) {
|
||||
if (disabledRegions.contains(region)) {
|
||||
for (String region : aregions)
|
||||
{
|
||||
if (disabledRegions.contains(region))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user