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 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;

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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