mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 10:17:38 +01:00
Correctly update the last location for a player on teleport
By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
parent
dcf25b2c5d
commit
059a14a3a5
@ -335,7 +335,21 @@
|
|||||||
this.checkMovement = false;
|
this.checkMovement = false;
|
||||||
this.o = d0;
|
this.o = d0;
|
||||||
this.p = d1;
|
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) {
|
public void a(PacketPlayInBlockDig packetplayinblockdig) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.u());
|
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.u());
|
||||||
@ -391,7 +405,7 @@
|
|||||||
double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D);
|
double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D);
|
||||||
double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D;
|
double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D;
|
||||||
double d2 = this.player.locZ - ((double) blockposition.getZ() + 0.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)) {
|
if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
|
||||||
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b());
|
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b());
|
||||||
} else {
|
} else {
|
||||||
@ -407,7 +421,7 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
|
if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
|
||||||
@@ -391,11 +626,22 @@
|
@@ -391,11 +634,22 @@
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Invalid player action");
|
throw new IllegalArgumentException("Invalid player action");
|
||||||
}
|
}
|
||||||
@ -430,7 +444,7 @@
|
|||||||
ItemStack itemstack = this.player.inventory.getItemInHand();
|
ItemStack itemstack = this.player.inventory.getItemInHand();
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
BlockPosition blockposition = packetplayinblockplace.a();
|
BlockPosition blockposition = packetplayinblockplace.a();
|
||||||
@@ -407,7 +653,50 @@
|
@@ -407,7 +661,50 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +496,7 @@
|
|||||||
} else if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && (enumdirection == EnumDirection.UP || blockposition.getY() >= this.minecraftServer.getMaxBuildHeight())) {
|
} 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())});
|
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));
|
this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage));
|
||||||
flag = true;
|
flag = true;
|
||||||
} else {
|
} else {
|
||||||
@ -503,7 +517,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
flag = true;
|
flag = true;
|
||||||
@@ -440,7 +740,8 @@
|
@@ -440,7 +748,8 @@
|
||||||
|
|
||||||
this.player.activeContainer.b();
|
this.player.activeContainer.b();
|
||||||
this.player.g = false;
|
this.player.g = false;
|
||||||
@ -513,7 +527,7 @@
|
|||||||
this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, this.player.inventory.getItemInHand()));
|
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;
|
WorldServer[] aworldserver = this.minecraftServer.worldServer;
|
||||||
int i = aworldserver.length;
|
int i = aworldserver.length;
|
||||||
|
|
||||||
@ -524,7 +538,7 @@
|
|||||||
|
|
||||||
if (worldserver != null) {
|
if (worldserver != null) {
|
||||||
entity = packetplayinspectate.a(worldserver);
|
entity = packetplayinspectate.a(worldserver);
|
||||||
@@ -468,6 +769,8 @@
|
@@ -468,6 +777,8 @@
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
this.player.setSpectatorTarget(this.player);
|
this.player.setSpectatorTarget(this.player);
|
||||||
this.player.mount((Entity) null);
|
this.player.mount((Entity) null);
|
||||||
@ -533,7 +547,7 @@
|
|||||||
if (entity.world != this.player.world) {
|
if (entity.world != this.player.world) {
|
||||||
WorldServer worldserver1 = this.player.u();
|
WorldServer worldserver1 = this.player.u();
|
||||||
WorldServer worldserver2 = (WorldServer) entity.world;
|
WorldServer worldserver2 = (WorldServer) entity.world;
|
||||||
@@ -492,6 +795,9 @@
|
@@ -492,6 +803,9 @@
|
||||||
} else {
|
} else {
|
||||||
this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ);
|
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(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {}
|
||||||
|
|
||||||
public void a(IChatBaseComponent ichatbasecomponent) {
|
public void a(IChatBaseComponent ichatbasecomponent) {
|
||||||
@ -575,7 +589,7 @@
|
|||||||
if (this.minecraftServer.T() && this.player.getName().equals(this.minecraftServer.S())) {
|
if (this.minecraftServer.T() && this.player.getName().equals(this.minecraftServer.S())) {
|
||||||
PlayerConnection.c.info("Stopping singleplayer server as player logged out");
|
PlayerConnection.c.info("Stopping singleplayer server as player logged out");
|
||||||
this.minecraftServer.safeShutdown();
|
this.minecraftServer.safeShutdown();
|
||||||
@@ -529,6 +850,15 @@
|
@@ -529,6 +858,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,7 +605,7 @@
|
|||||||
try {
|
try {
|
||||||
this.networkManager.handle(packet);
|
this.networkManager.handle(packet);
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
@@ -549,18 +879,34 @@
|
@@ -549,18 +887,34 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||||
@ -628,7 +642,7 @@
|
|||||||
ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
|
ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
|
||||||
|
|
||||||
chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
|
chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
|
||||||
@@ -573,39 +919,249 @@
|
@@ -573,39 +927,249 @@
|
||||||
|
|
||||||
for (int i = 0; i < s.length(); ++i) {
|
for (int i = 0; i < s.length(); ++i) {
|
||||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
||||||
@ -886,7 +900,7 @@
|
|||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
switch (PlayerConnection.SyntheticClass_1.b[packetplayinentityaction.b().ordinal()]) {
|
switch (PlayerConnection.SyntheticClass_1.b[packetplayinentityaction.b().ordinal()]) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -626,7 +1182,7 @@
|
@@ -626,7 +1190,7 @@
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
this.player.a(false, true, true);
|
this.player.a(false, true, true);
|
||||||
@ -895,7 +909,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
@@ -648,6 +1204,7 @@
|
@@ -648,6 +1212,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInUseEntity packetplayinuseentity) {
|
public void a(PacketPlayInUseEntity packetplayinuseentity) {
|
||||||
@ -903,7 +917,7 @@
|
|||||||
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u());
|
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u());
|
||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
Entity entity = packetplayinuseentity.a((World) worldserver);
|
Entity entity = packetplayinuseentity.a((World) worldserver);
|
||||||
@@ -662,18 +1219,67 @@
|
@@ -662,18 +1227,67 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.player.h(entity) < d0) {
|
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()]) {
|
switch (PlayerConnection.SyntheticClass_1.c[packetplayinclientcommand_enumclientcommand.ordinal()]) {
|
||||||
case 1:
|
case 1:
|
||||||
if (this.player.viewingCredits) {
|
if (this.player.viewingCredits) {
|
||||||
@ -982,7 +996,7 @@
|
|||||||
} else if (this.player.u().getWorldData().isHardcore()) {
|
} else if (this.player.u().getWorldData().isHardcore()) {
|
||||||
if (this.minecraftServer.T() && this.player.getName().equals(this.minecraftServer.S())) {
|
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!");
|
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) {
|
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||||
@ -1005,7 +1019,7 @@
|
|||||||
ArrayList arraylist = Lists.newArrayList();
|
ArrayList arraylist = Lists.newArrayList();
|
||||||
|
|
||||||
for (int i = 0; i < this.player.activeContainer.c.size(); ++i) {
|
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);
|
this.player.a(this.player.activeContainer, (List) arraylist);
|
||||||
} else {
|
} else {
|
||||||
@ -1277,7 +1291,7 @@
|
|||||||
|
|
||||||
if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) {
|
if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) {
|
||||||
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true));
|
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();
|
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize();
|
||||||
@ -1327,7 +1341,7 @@
|
|||||||
|
|
||||||
if (flag1 && flag2 && flag3) {
|
if (flag1 && flag2 && flag3) {
|
||||||
if (itemstack == null) {
|
if (itemstack == null) {
|
||||||
@@ -821,6 +1737,7 @@
|
@@ -821,6 +1745,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInTransaction packetplayintransaction) {
|
public void a(PacketPlayInTransaction packetplayintransaction) {
|
||||||
@ -1335,7 +1349,7 @@
|
|||||||
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u());
|
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u());
|
||||||
Short oshort = (Short) this.n.get(this.player.activeContainer.windowId);
|
Short oshort = (Short) this.n.get(this.player.activeContainer.windowId);
|
||||||
|
|
||||||
@@ -831,6 +1748,7 @@
|
@@ -831,6 +1756,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
||||||
@ -1343,7 +1357,7 @@
|
|||||||
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u());
|
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u());
|
||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
@@ -847,14 +1765,30 @@
|
@@ -847,14 +1773,30 @@
|
||||||
|
|
||||||
if (!tileentitysign.b() || tileentitysign.c() != this.player) {
|
if (!tileentitysign.b() || tileentitysign.c() != this.player) {
|
||||||
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
|
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
|
||||||
@ -1375,7 +1389,7 @@
|
|||||||
|
|
||||||
tileentitysign.update();
|
tileentitysign.update();
|
||||||
worldserver.notify(blockposition);
|
worldserver.notify(blockposition);
|
||||||
@@ -877,11 +1811,27 @@
|
@@ -877,11 +1819,27 @@
|
||||||
|
|
||||||
public void a(PacketPlayInAbilities packetplayinabilities) {
|
public void a(PacketPlayInAbilities packetplayinabilities) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u());
|
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u());
|
||||||
@ -1404,7 +1418,7 @@
|
|||||||
ArrayList arraylist = Lists.newArrayList();
|
ArrayList arraylist = Lists.newArrayList();
|
||||||
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator();
|
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();
|
itemstack1 = this.player.inventory.getItemInHand();
|
||||||
if (itemstack1 != null) {
|
if (itemstack1 != null) {
|
||||||
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
|
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
|
||||||
@ -1421,7 +1435,7 @@
|
|||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
packetdataserializer.release();
|
packetdataserializer.release();
|
||||||
@@ -950,16 +1903,21 @@
|
@@ -950,16 +1911,21 @@
|
||||||
itemstack1 = this.player.inventory.getItemInHand();
|
itemstack1 = this.player.inventory.getItemInHand();
|
||||||
if (itemstack1 != null) {
|
if (itemstack1 != null) {
|
||||||
if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
|
if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
|
||||||
@ -1443,7 +1457,7 @@
|
|||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
packetdataserializer.release();
|
packetdataserializer.release();
|
||||||
@@ -976,11 +1934,12 @@
|
@@ -976,11 +1942,12 @@
|
||||||
}
|
}
|
||||||
} catch (Exception exception2) {
|
} catch (Exception exception2) {
|
||||||
PlayerConnection.c.error("Couldn\'t select trade", exception2);
|
PlayerConnection.c.error("Couldn\'t select trade", exception2);
|
||||||
@ -1457,7 +1471,7 @@
|
|||||||
packetdataserializer = packetplayincustompayload.b();
|
packetdataserializer = packetplayincustompayload.b();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1016,6 +1975,7 @@
|
@@ -1016,6 +1983,7 @@
|
||||||
}
|
}
|
||||||
} catch (Exception exception3) {
|
} catch (Exception exception3) {
|
||||||
PlayerConnection.c.error("Couldn\'t set command block", exception3);
|
PlayerConnection.c.error("Couldn\'t set command block", exception3);
|
||||||
@ -1465,7 +1479,7 @@
|
|||||||
} finally {
|
} finally {
|
||||||
packetdataserializer.release();
|
packetdataserializer.release();
|
||||||
}
|
}
|
||||||
@@ -1041,6 +2001,7 @@
|
@@ -1041,6 +2009,7 @@
|
||||||
}
|
}
|
||||||
} catch (Exception exception4) {
|
} catch (Exception exception4) {
|
||||||
PlayerConnection.c.error("Couldn\'t set beacon", 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) {
|
} else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) {
|
||||||
@@ -1056,7 +2017,28 @@
|
@@ -1056,7 +2025,28 @@
|
||||||
containeranvil.a("");
|
containeranvil.a("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user