Don't manually send ClientboundPlayerPositionPacket for refreshPlayer

in 1.19, mojang made it so that teleporations validate that an awaiting pos was
set in the server when teleporting, thus we need to ensure that this is set when
sending the player pos, otherwise the player will be kicked when the client sends
back the aknowledgement
This commit is contained in:
Shane Freeder 2022-08-10 15:01:39 +01:00
parent 954b3fb7d5
commit 2cab6963a7
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C

View file

@ -24,7 +24,7 @@ index fa949d01da7b6c1a489d17955108f7082f959c66..c83395364edb4f2ba8515326b19c4f1a
playerName = gameProfile.getName();
uniqueId = gameProfile.getId();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c5164abae83cf6b0535d72c78adff5b72bc6f22e..63327bb4a57dea10f421bff15664ffa57c56cf65 100644
index 299f2a8c45462d8070312c98554dbcc05298c681..31bcabd4c6ac3aa261c439a154ba7eb0f8caa0b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -75,6 +75,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
@ -131,7 +131,7 @@ index c5164abae83cf6b0535d72c78adff5b72bc6f22e..63327bb4a57dea10f421bff15664ffa5
+ ServerLevel worldserver = handle.getLevel();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getHandle().getLastDeathLocation()));
+ handle.onUpdateAbilities();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet(), 0, false));
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet(), false);
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle);
+
+ if (this.isOp()) {