SPIGOT-6114: PlayerRespawnEvent player's location changed before event called

This commit is contained in:
md_5 2020-08-28 12:27:08 +10:00
parent 3b5c367699
commit 97da39889c
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -428,7 +428,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection; entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyFrom(entityplayer, flag); entityplayer1.copyFrom(entityplayer, flag);
@@ -444,52 +622,114 @@ @@ -444,52 +622,113 @@
entityplayer1.addScoreboardTag(s); entityplayer1.addScoreboardTag(s);
} }
@ -473,7 +473,6 @@
+ } + }
- f1 = (float) MathHelper.g(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D); - f1 = (float) MathHelper.g(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
+ entityplayer1.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
+ entityplayer1.setRespawnPosition(worldserver1.getDimensionKey(), blockposition, f, flag1, false); + entityplayer1.setRespawnPosition(worldserver1.getDimensionKey(), blockposition, f, flag1, false);
+ flag2 = !flag && flag3; + flag2 = !flag && flag3;
+ isBedSpawn = true; + isBedSpawn = true;
@ -568,7 +567,7 @@
return entityplayer1; return entityplayer1;
} }
@@ -502,7 +742,18 @@ @@ -502,7 +741,18 @@
public void tick() { public void tick() {
if (++this.w > 600) { if (++this.w > 600) {
@ -588,7 +587,7 @@
this.w = 0; this.w = 0;
} }
@@ -515,6 +766,25 @@ @@ -515,6 +765,25 @@
} }
@ -614,7 +613,7 @@
public void a(Packet<?> packet, ResourceKey<World> resourcekey) { public void a(Packet<?> packet, ResourceKey<World> resourcekey) {
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@@ -615,6 +885,7 @@ @@ -615,6 +884,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
} }
@ -622,7 +621,7 @@
this.server.getCommandDispatcher().a(entityplayer); this.server.getCommandDispatcher().a(entityplayer);
} }
@@ -647,6 +918,12 @@ @@ -647,6 +917,12 @@
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@ -635,7 +634,7 @@
if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey) { if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey) {
double d4 = d0 - entityplayer.locX(); double d4 = d0 - entityplayer.locX();
double d5 = d1 - entityplayer.locY(); double d5 = d1 - entityplayer.locY();
@@ -686,23 +963,34 @@ @@ -686,23 +962,34 @@
public void reloadWhitelist() {} public void reloadWhitelist() {}
public void a(EntityPlayer entityplayer, WorldServer worldserver) { public void a(EntityPlayer entityplayer, WorldServer worldserver) {
@ -675,7 +674,7 @@
} }
public int getPlayerCount() { public int getPlayerCount() {
@@ -755,31 +1043,54 @@ @@ -755,31 +1042,54 @@
entityplayer.playerInteractManager.a(this.u, EnumGamemode.NOT_SET); entityplayer.playerInteractManager.a(this.u, EnumGamemode.NOT_SET);
} }
@ -738,7 +737,7 @@
if (file2.exists() && file2.isFile()) { if (file2.exists() && file2.isFile()) {
file2.renameTo(file1); file2.renameTo(file1);
@@ -787,7 +1098,7 @@ @@ -787,7 +1097,7 @@
} }
serverstatisticmanager = new ServerStatisticManager(this.server, file1); serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@ -747,7 +746,7 @@
} }
return serverstatisticmanager; return serverstatisticmanager;
@@ -795,14 +1106,14 @@ @@ -795,14 +1105,14 @@
public AdvancementDataPlayer f(EntityPlayer entityplayer) { public AdvancementDataPlayer f(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUniqueID(); UUID uuid = entityplayer.getUniqueID();
@ -764,7 +763,7 @@
} }
advancementdataplayer.a(entityplayer); advancementdataplayer.a(entityplayer);
@@ -838,13 +1149,20 @@ @@ -838,13 +1148,20 @@
} }
public void reload() { public void reload() {