Use getX instead of getblockX. Don't make it 1.8 specific

This commit is contained in:
libraryaddict 2014-09-29 14:08:58 +13:00
parent 465257f11a
commit 0af1924e61

View File

@ -94,11 +94,9 @@ public class DisguiseListener implements Listener {
private void chunkMove(Player player, Location newLoc, Location oldLoc) { private void chunkMove(Player player, Location newLoc, Location oldLoc) {
try { try {
if (ReflectionManager.is1_8(player)) {
for (PacketContainer packet : DisguiseUtilities.getBedChunkPacket(player, newLoc, oldLoc)) { for (PacketContainer packet : DisguiseUtilities.getBedChunkPacket(player, newLoc, oldLoc)) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false); ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false);
} }
}
if (newLoc != null) { if (newLoc != null) {
for (HashSet<TargetedDisguise> list : DisguiseUtilities.getDisguises().values()) { for (HashSet<TargetedDisguise> list : DisguiseUtilities.getDisguises().values()) {
for (TargetedDisguise disguise : list) { for (TargetedDisguise disguise : list) {
@ -156,8 +154,8 @@ public class DisguiseListener implements Listener {
if (DisguiseConfig.isBedPacketsEnabled()) { if (DisguiseConfig.isBedPacketsEnabled()) {
Location to = event.getTo(); Location to = event.getTo();
Location from = event.getFrom(); Location from = event.getFrom();
if (Math.floor(to.getBlockX() / 160D) != Math.floor(from.getBlockX() / 160D) if (Math.floor(to.getX() / 160D) != Math.floor(from.getX() / 160D)
|| Math.floor(to.getBlockZ() / 160D) != Math.floor(from.getBlockZ() / 160D)) { || Math.floor(to.getZ() / 160D) != Math.floor(from.getZ() / 160D)) {
chunkMove(event.getPlayer(), to, from); chunkMove(event.getPlayer(), to, from);
} }
} }
@ -283,8 +281,8 @@ public class DisguiseListener implements Listener {
if (DisguiseConfig.isBedPacketsEnabled()) { if (DisguiseConfig.isBedPacketsEnabled()) {
Location to = event.getTo(); Location to = event.getTo();
Location from = event.getFrom(); Location from = event.getFrom();
if (Math.floor(to.getBlockX() / 160D) != Math.floor(from.getBlockX() / 160D) if (Math.floor(to.getX() / 160D) != Math.floor(from.getX() / 160D)
|| Math.floor(to.getBlockZ() / 160D) != Math.floor(from.getBlockZ() / 160D)) { || Math.floor(to.getZ() / 160D) != Math.floor(from.getZ() / 160D)) {
chunkMove(event.getPlayer(), null, from); chunkMove(event.getPlayer(), null, from);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() { public void run() {