Minor tweaks

This commit is contained in:
boy0001 2015-07-20 15:14:46 +10:00
parent 9c635810b0
commit 38f0e82447
6 changed files with 13 additions and 18 deletions

View File

@ -234,13 +234,13 @@ public class BukkitHybridUtils extends HybridUtils {
int minZ; int minZ;
int maxX; int maxX;
int maxZ; int maxZ;
if (X == cbx) minX = MathMan.mod(bx); if (X == cbx) minX = bx & 0x0f;
else minX = 0; else minX = 0;
if (Z == cbz) minZ = MathMan.mod(bz); if (Z == cbz) minZ = bz & 0x0f;
else minZ = 0; else minZ = 0;
if (X == ctx) maxX = MathMan.mod(tx); if (X == ctx) maxX = tx & 0x0f;
else maxX = 16; else maxX = 16;
if (Z == ctz) maxZ = MathMan.mod(tz); if (Z == ctz) maxZ = tz & 0x0f;
else maxZ = 16; else maxZ = 16;
int cbx = X << 4; int cbx = X << 4;

View File

@ -81,8 +81,7 @@ public class BukkitPlayer implements PlotPlayer {
@Override @Override
public void teleport(final Location loc) { 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 @Override

View File

@ -314,7 +314,7 @@ public class MainUtil {
public static Location getDefaultHome(Plot plot) { public static Location getDefaultHome(Plot plot) {
PlotWorld plotworld = PS.get().getPlotWorld(plot.world); PlotWorld plotworld = PS.get().getPlotWorld(plot.world);
if (plotworld.DEFAULT_HOME != null) { 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 PlotManager manager = PS.get().getPlotManager(plot.world);
final int x; final int x;
final int z; final int z;
@ -331,7 +331,7 @@ public class MainUtil {
return new Location(plot.world, x, y + 1, z); return new Location(plot.world, x, y + 1, z);
} }
final Location top = getPlotTopLoc(plot.world, plot.id); 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 x = ((top.getX() - bot.getX()) / 2) + bot.getX();
final int z = bot.getZ(); final int z = bot.getZ();
PlotManager manager = PS.get().getPlotManager(plot.world); PlotManager manager = PS.get().getPlotManager(plot.world);

View File

@ -52,11 +52,4 @@ public class MathMan {
public static boolean isPowerOfTwo(int x) { public static boolean isPowerOfTwo(int x) {
return (x & (x - 1)) == 0; return (x & (x - 1)) == 0;
} }
public static int mod(int x) {
if (x < 0) {
return (x % 16) + 16;
}
return x % 16;
}
} }

View File

@ -197,7 +197,10 @@ public class BukkitUtil extends BlockManager {
} }
public static Location getLocationFull(final Entity entity) { 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(); final String world = loc.getWorld().getName();
return new Location(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getYaw(), loc.getPitch()); return new Location(world, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getYaw(), loc.getPitch());
} }
@ -258,7 +261,7 @@ public class BukkitUtil extends BlockManager {
@Override @Override
public Location getSpawn(final String world) { public Location getSpawn(final String world) {
final org.bukkit.Location temp = getWorld(world).getSpawnLocation(); 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 @Override