diff --git a/src/com/cnaude/chairs/ChairEffects.java b/src/com/cnaude/chairs/ChairEffects.java index e9531de..dad6a22 100644 --- a/src/com/cnaude/chairs/ChairEffects.java +++ b/src/com/cnaude/chairs/ChairEffects.java @@ -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(); diff --git a/src/com/cnaude/chairs/WGHook.java b/src/com/cnaude/chairs/WGHook.java index f2e09c8..5e547c7 100644 --- a/src/com/cnaude/chairs/WGHook.java +++ b/src/com/cnaude/chairs/WGHook.java @@ -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 disabledRegions, Location location) { - try { - if (disabledRegions.isEmpty()) {return true;} - - List aregions = WGBukkit.getRegionManager(location.getWorld()).getApplicableRegionsIDs(BukkitUtil.toVector(location)); - for (String region : aregions) { - if (disabledRegions.contains(region)) { - return false; - } + if (Bukkit.getPluginManager().getPlugin("WorldGuard") == null) + { + return true; + } + if (disabledRegions.isEmpty()) + { + return true; + } + + List aregions = WGBukkit.getRegionManager(location.getWorld()).getApplicableRegionsIDs(BukkitUtil.toVector(location)); + for (String region : aregions) + { + if (disabledRegions.contains(region)) + { + return false; } - } catch (Exception e) {} + } return true; }