From 49dc0599c94b06517e7770b4a8291c875ce3ed93 Mon Sep 17 00:00:00 2001 From: zml2008 Date: Thu, 1 Mar 2012 20:49:01 -0800 Subject: [PATCH] Remove leftover 128 value, fix RegionGroup.ALL handling --- .../sk89q/worldguard/bukkit/BukkitUtil.java | 32 +++++++++---------- .../protection/flags/RegionGroupFlag.java | 4 +-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java b/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java index 72c49ecc..27c5ae9b 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/BukkitUtil.java @@ -44,32 +44,32 @@ public class BukkitUtil { private BukkitUtil() { - + } - + /** * Converts the location of a Bukkit block to a WorldEdit vector. - * + * * @param block The block to convert * @return The block's location as a BlockVector */ public static BlockVector toVector(Block block) { return new BlockVector(block.getX(), block.getY(), block.getZ()); } - + /** * Converts a Bukkit location to a WorldEdit vector. - * + * * @param loc A Bukkit Location * @return A Vector with the location's x, y, and z values */ public static Vector toVector(Location loc) { return new Vector(loc.getX(), loc.getY(), loc.getZ()); } - + /** * Converts a Bukkit vector to a WorldEdit vector. - * + * * @param vector The Bukkit vector * @return A WorldEdit vector with the same values as the Bukkit vector. */ @@ -79,7 +79,7 @@ public static Vector toVector(org.bukkit.util.Vector vector) { /** * Converts a WorldEdit vector to a Bukkit location. - * + * * @param world The World to create the new Location with * @param vec The vector to use for coordinates * @return The Vector as a location with a World of world @@ -87,10 +87,10 @@ public static Vector toVector(org.bukkit.util.Vector vector) { public static Location toLocation(World world, Vector vec) { return new Location(world, vec.getX(), vec.getY(), vec.getZ()); } - + /** * Matches one player based on name. - * + * * @param server The server to check * @param name The name to attempt to match * @deprecated see {@link WorldGuardPlugin#matchSinglePlayer(org.bukkit.command.CommandSender, String)} @@ -104,10 +104,10 @@ public static Player matchSinglePlayer(Server server, String name) { } return players.get(0); } - + /** * Drops a sign item and removes a sign. - * + * * @param block The block * @deprecated see {@link org.bukkit.block.Block#breakNaturally()} */ @@ -121,7 +121,7 @@ public static void dropSign(Block block) { /** * Sets the given block to fluid water. * Used by addSpongeWater() - * + * * @param world * @param ox * @param oy @@ -137,12 +137,12 @@ public static void setBlockToWater(World world, int ox, int oy, int oz) { /** * Checks if the given block is water - * + * * @param world * @param ox * @param oy * @param oz - * @return + * @return */ public static boolean isBlockWater(World world, int ox, int oy, int oz) { Block block = world.getBlockAt(ox, oy, oz); @@ -172,7 +172,7 @@ public static void findFreePosition(Player player) { byte free = 0; - while (y <= 129) { + while (y <= world.getMaxHeight() + 1) { if (BlockType.canPassThrough(world.getBlockTypeIdAt(x, y, z))) { free++; } else { diff --git a/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java b/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java index 90ec4797..298bc941 100644 --- a/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java +++ b/src/main/java/com/sk89q/worldguard/protection/flags/RegionGroupFlag.java @@ -62,7 +62,7 @@ public RegionGroup detectValue(String input) { } public static boolean isMember(ProtectedRegion region, RegionGroup group, LocalPlayer player) { - if (group == null) { + if (group == null || group == RegionGroup.ALL) { return true; } else if (group == RegionGroup.OWNERS) { if (region.isOwner(player)) { @@ -87,7 +87,7 @@ public static boolean isMember(ProtectedRegion region, RegionGroup group, LocalP public static boolean isMember(ApplicableRegionSet set, RegionGroup group, LocalPlayer player) { - if (group == RegionGroup.ALL) { + if (group == null || group == RegionGroup.ALL) { return true; } else if (group == RegionGroup.OWNERS) { if (set.isOwnerOfAll(player)) {