From 38f0e82447785cb6f5ab6d8f7d73838502a795b2 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 20 Jul 2015 15:14:46 +1000 Subject: [PATCH] Minor tweaks --- .../plot/generator/BukkitHybridUtils.java | 8 ++++---- .../intellectualcrafters/plot/object/BukkitPlayer.java | 3 +-- .../com/intellectualcrafters/plot/object/PlotPlayer.java | 2 +- .../java/com/intellectualcrafters/plot/util/MainUtil.java | 4 ++-- .../java/com/intellectualcrafters/plot/util/MathMan.java | 7 ------- .../intellectualcrafters/plot/util/bukkit/BukkitUtil.java | 7 +++++-- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java b/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java index 9c4c0cc0d..c851cd929 100644 --- a/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java +++ b/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java @@ -234,13 +234,13 @@ public class BukkitHybridUtils extends HybridUtils { int minZ; int maxX; int maxZ; - if (X == cbx) minX = MathMan.mod(bx); + if (X == cbx) minX = bx & 0x0f; else minX = 0; - if (Z == cbz) minZ = MathMan.mod(bz); + if (Z == cbz) minZ = bz & 0x0f; else minZ = 0; - if (X == ctx) maxX = MathMan.mod(tx); + if (X == ctx) maxX = tx & 0x0f; else maxX = 16; - if (Z == ctz) maxZ = MathMan.mod(tz); + if (Z == ctz) maxZ = tz & 0x0f; else maxZ = 16; int cbx = X << 4; diff --git a/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java b/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java index b6db79291..297beb47b 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java +++ b/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java @@ -81,8 +81,7 @@ public class BukkitPlayer implements PlotPlayer { @Override public void teleport(final Location loc) { - this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX(), loc.getY(), loc.getZ())); - + this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch())); } @Override diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java b/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java index a824192ca..37ec9c3fb 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java +++ b/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java @@ -22,7 +22,7 @@ public interface PlotPlayer { public void sendMessage(final String message); public void teleport(final Location loc); - + public boolean isOp(); public boolean isOnline(); diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 499dee7c6..0960a8ebb 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -314,7 +314,7 @@ public class MainUtil { public static Location getDefaultHome(Plot plot) { PlotWorld plotworld = PS.get().getPlotWorld(plot.world); if (plotworld.DEFAULT_HOME != null) { - final Location bot = getPlotBottomLoc(plot.world, plot.id); + final Location bot = getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1); final PlotManager manager = PS.get().getPlotManager(plot.world); final int x; final int z; @@ -331,7 +331,7 @@ public class MainUtil { return new Location(plot.world, x, y + 1, z); } final Location top = getPlotTopLoc(plot.world, plot.id); - final Location bot = getPlotBottomLoc(plot.world, plot.id); + final Location bot = getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1); final int x = ((top.getX() - bot.getX()) / 2) + bot.getX(); final int z = bot.getZ(); PlotManager manager = PS.get().getPlotManager(plot.world); diff --git a/src/main/java/com/intellectualcrafters/plot/util/MathMan.java b/src/main/java/com/intellectualcrafters/plot/util/MathMan.java index 7f062797f..390896d06 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MathMan.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MathMan.java @@ -52,11 +52,4 @@ public class MathMan { public static boolean isPowerOfTwo(int x) { return (x & (x - 1)) == 0; } - - public static int mod(int x) { - if (x < 0) { - return (x % 16) + 16; - } - return x % 16; - } } diff --git a/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java b/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java index 089678b76..b6d5ca987 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java @@ -197,7 +197,10 @@ public class BukkitUtil extends BlockManager { } public static Location getLocationFull(final Entity entity) { - final org.bukkit.Location loc = entity.getLocation(); + return getLocation(entity.getLocation()); + } + + public static Location getLocationFull(final org.bukkit.Location loc) { final String world = loc.getWorld().getName(); return new Location(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getYaw(), loc.getPitch()); } @@ -258,7 +261,7 @@ public class BukkitUtil extends BlockManager { @Override public Location getSpawn(final String world) { final org.bukkit.Location temp = getWorld(world).getSpawnLocation(); - return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ()); + return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ(), temp.getYaw(), temp.getPitch()); } @Override