summaryrefslogtreecommitdiffstats
path: root/nms-patches/PlayerConnection.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-07-23 20:37:58 +0100
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-07-23 20:37:58 +0100
commitdc40c528d76425e9f0423c561a850f5f7668f537 (patch)
tree2c3c521b91b61c22b503ed846d65f2e20eb9361a /nms-patches/PlayerConnection.patch
parenta3cb1bcd92a284fb6c86a7634d5842bd68ef8d81 (diff)
downloadcraftbukkit-dc40c528d76425e9f0423c561a850f5f7668f537.tar
craftbukkit-dc40c528d76425e9f0423c561a850f5f7668f537.tar.gz
craftbukkit-dc40c528d76425e9f0423c561a850f5f7668f537.tar.lz
craftbukkit-dc40c528d76425e9f0423c561a850f5f7668f537.tar.xz
craftbukkit-dc40c528d76425e9f0423c561a850f5f7668f537.zip
Correctly update the last location for a player on teleport
Diffstat (limited to 'nms-patches/PlayerConnection.patch')
-rw-r--r--nms-patches/PlayerConnection.patch74
1 files changed, 44 insertions, 30 deletions
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch
index 8bf7b11d..aa3547b5 100644
--- a/nms-patches/PlayerConnection.patch
+++ b/nms-patches/PlayerConnection.patch
@@ -335,7 +335,21 @@
this.checkMovement = false;
this.o = d0;
this.p = d1;
-@@ -331,32 +541,49 @@
+@@ -325,38 +535,63 @@
+ f3 = f1 + this.player.pitch;
+ }
+
++ // CraftBukkit start - update last location
++ this.lastPosX = this.o;
++ this.lastPosY = this.p;
++ this.lastPosZ = this.q;
++ this.lastYaw = f2;
++ this.lastPitch = f3;
++ // CraftBukkit end
++
+ this.player.setLocation(this.o, this.p, this.q, f2, f3);
+ this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0, d1, d2, f, f1, set));
+ }
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.u());
@@ -391,7 +405,7 @@
double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D);
double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D;
double d2 = this.player.locZ - ((double) blockposition.getZ() + 0.5D);
-@@ -371,7 +598,15 @@
+@@ -371,7 +606,15 @@
if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b());
} else {
@@ -407,7 +421,7 @@
}
} else {
if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
-@@ -391,11 +626,22 @@
+@@ -391,11 +634,22 @@
default:
throw new IllegalArgumentException("Invalid player action");
}
@@ -430,7 +444,7 @@
ItemStack itemstack = this.player.inventory.getItemInHand();
boolean flag = false;
BlockPosition blockposition = packetplayinblockplace.a();
-@@ -407,7 +653,50 @@
+@@ -407,7 +661,50 @@
return;
}
@@ -482,7 +496,7 @@
} else if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && (enumdirection == EnumDirection.UP || blockposition.getY() >= this.minecraftServer.getMaxBuildHeight())) {
ChatMessage chatmessage = new ChatMessage("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())});
-@@ -415,8 +704,19 @@
+@@ -415,8 +712,19 @@
this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage));
flag = true;
} else {
@@ -503,7 +517,7 @@
}
flag = true;
-@@ -440,7 +740,8 @@
+@@ -440,7 +748,8 @@
this.player.activeContainer.b();
this.player.g = false;
@@ -513,7 +527,7 @@
this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, this.player.inventory.getItemInHand()));
}
}
-@@ -454,8 +755,8 @@
+@@ -454,8 +763,8 @@
WorldServer[] aworldserver = this.minecraftServer.worldServer;
int i = aworldserver.length;
@@ -524,7 +538,7 @@
if (worldserver != null) {
entity = packetplayinspectate.a(worldserver);
-@@ -468,6 +769,8 @@
+@@ -468,6 +777,8 @@
if (entity != null) {
this.player.setSpectatorTarget(this.player);
this.player.mount((Entity) null);
@@ -533,7 +547,7 @@
if (entity.world != this.player.world) {
WorldServer worldserver1 = this.player.u();
WorldServer worldserver2 = (WorldServer) entity.world;
-@@ -492,6 +795,9 @@
+@@ -492,6 +803,9 @@
} else {
this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ);
}
@@ -543,7 +557,7 @@
}
}
-@@ -500,14 +806,29 @@
+@@ -500,14 +814,29 @@
public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {}
public void a(IChatBaseComponent ichatbasecomponent) {
@@ -575,7 +589,7 @@
if (this.minecraftServer.T() && this.player.getName().equals(this.minecraftServer.S())) {
PlayerConnection.c.info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown();
-@@ -529,6 +850,15 @@
+@@ -529,6 +858,15 @@
}
}
@@ -591,7 +605,7 @@
try {
this.networkManager.handle(packet);
} catch (Throwable throwable) {
-@@ -549,18 +879,34 @@
+@@ -549,18 +887,34 @@
}
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
@@ -628,7 +642,7 @@
ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
-@@ -573,39 +919,249 @@
+@@ -573,39 +927,249 @@
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@@ -886,7 +900,7 @@
this.player.resetIdleTimer();
switch (PlayerConnection.SyntheticClass_1.b[packetplayinentityaction.b().ordinal()]) {
case 1:
-@@ -626,7 +1182,7 @@
+@@ -626,7 +1190,7 @@
case 5:
this.player.a(false, true, true);
@@ -895,7 +909,7 @@
break;
case 6:
-@@ -648,6 +1204,7 @@
+@@ -648,6 +1212,7 @@
}
public void a(PacketPlayInUseEntity packetplayinuseentity) {
@@ -903,7 +917,7 @@
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u());
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = packetplayinuseentity.a((World) worldserver);
-@@ -662,18 +1219,67 @@
+@@ -662,18 +1227,67 @@
}
if (this.player.h(entity) < d0) {
@@ -972,7 +986,7 @@
}
}
}
-@@ -688,7 +1294,8 @@
+@@ -688,7 +1302,8 @@
switch (PlayerConnection.SyntheticClass_1.c[packetplayinclientcommand_enumclientcommand.ordinal()]) {
case 1:
if (this.player.viewingCredits) {
@@ -982,7 +996,7 @@
} else if (this.player.u().getWorldData().isHardcore()) {
if (this.minecraftServer.T() && this.player.getName().equals(this.minecraftServer.S())) {
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
-@@ -719,15 +1326,21 @@
+@@ -719,15 +1334,21 @@
}
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
@@ -1005,7 +1019,7 @@
ArrayList arraylist = Lists.newArrayList();
for (int i = 0; i < this.player.activeContainer.c.size(); ++i) {
-@@ -736,7 +1349,270 @@
+@@ -736,7 +1357,270 @@
this.player.a(this.player.activeContainer, (List) arraylist);
} else {
@@ -1277,7 +1291,7 @@
if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true));
-@@ -797,8 +1673,48 @@
+@@ -797,8 +1681,48 @@
}
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize();
@@ -1327,7 +1341,7 @@
if (flag1 && flag2 && flag3) {
if (itemstack == null) {
-@@ -821,6 +1737,7 @@
+@@ -821,6 +1745,7 @@
}
public void a(PacketPlayInTransaction packetplayintransaction) {
@@ -1335,7 +1349,7 @@
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u());
Short oshort = (Short) this.n.get(this.player.activeContainer.windowId);
-@@ -831,6 +1748,7 @@
+@@ -831,6 +1756,7 @@
}
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
@@ -1343,7 +1357,7 @@
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u());
this.player.resetIdleTimer();
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
-@@ -847,14 +1765,30 @@
+@@ -847,14 +1773,30 @@
if (!tileentitysign.b() || tileentitysign.c() != this.player) {
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
@@ -1375,7 +1389,7 @@
tileentitysign.update();
worldserver.notify(blockposition);
-@@ -877,11 +1811,27 @@
+@@ -877,11 +1819,27 @@
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u());
@@ -1404,7 +1418,7 @@
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator();
-@@ -921,13 +1871,16 @@
+@@ -921,13 +1879,16 @@
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
@@ -1421,7 +1435,7 @@
return;
} finally {
packetdataserializer.release();
-@@ -950,16 +1903,21 @@
+@@ -950,16 +1911,21 @@
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
@@ -1443,7 +1457,7 @@
return;
} finally {
packetdataserializer.release();
-@@ -976,11 +1934,12 @@
+@@ -976,11 +1942,12 @@
}
} catch (Exception exception2) {
PlayerConnection.c.error("Couldn\'t select trade", exception2);
@@ -1457,7 +1471,7 @@
packetdataserializer = packetplayincustompayload.b();
try {
-@@ -1016,6 +1975,7 @@
+@@ -1016,6 +1983,7 @@
}
} catch (Exception exception3) {
PlayerConnection.c.error("Couldn\'t set command block", exception3);
@@ -1465,7 +1479,7 @@
} finally {
packetdataserializer.release();
}
-@@ -1041,6 +2001,7 @@
+@@ -1041,6 +2009,7 @@
}
} catch (Exception exception4) {
PlayerConnection.c.error("Couldn\'t set beacon", exception4);
@@ -1473,7 +1487,7 @@
}
}
} else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) {
-@@ -1056,7 +2017,28 @@
+@@ -1056,7 +2025,28 @@
containeranvil.a("");
}
}