SPIGOT-5988: Bedspawn doesn't clear after dying when spawn is blocked

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2021-10-16 19:39:14 +11:00
parent ea404e3d82
commit ab1a1deb6b

View File

@ -435,7 +435,7 @@
entityplayer1.connection = entityplayer.connection; entityplayer1.connection = entityplayer.connection;
entityplayer1.copyFrom(entityplayer, flag); entityplayer1.copyFrom(entityplayer, flag);
@@ -495,49 +680,110 @@ @@ -495,49 +680,111 @@
boolean flag2 = false; boolean flag2 = false;
@ -482,6 +482,7 @@
+ location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F); + location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
+ } else if (blockposition != null) { + } else if (blockposition != null) {
+ entityplayer1.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); + entityplayer1.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
+ } + }
+ } + }
+ +
@ -570,7 +571,7 @@
return entityplayer1; return entityplayer1;
} }
@@ -550,7 +796,18 @@ @@ -550,7 +797,18 @@
public void tick() { public void tick() {
if (++this.sendAllPlayerInfoIn > 600) { if (++this.sendAllPlayerInfoIn > 600) {
@ -590,7 +591,7 @@
this.sendAllPlayerInfoIn = 0; this.sendAllPlayerInfoIn = 0;
} }
@@ -567,6 +824,25 @@ @@ -567,6 +825,25 @@
} }
@ -616,7 +617,7 @@
public void a(Packet<?> packet, ResourceKey<World> resourcekey) { public void a(Packet<?> packet, ResourceKey<World> resourcekey) {
Iterator iterator = this.players.iterator(); Iterator iterator = this.players.iterator();
@@ -669,6 +945,7 @@ @@ -669,6 +946,7 @@
entityplayer.connection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); entityplayer.connection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
} }
@ -624,7 +625,7 @@
this.server.getCommandDispatcher().a(entityplayer); this.server.getCommandDispatcher().a(entityplayer);
} }
@@ -701,6 +978,12 @@ @@ -701,6 +979,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);
@ -637,7 +638,7 @@
if (entityplayer != entityhuman && entityplayer.level.getDimensionKey() == resourcekey) { if (entityplayer != entityhuman && entityplayer.level.getDimensionKey() == resourcekey) {
double d4 = d0 - entityplayer.locX(); double d4 = d0 - entityplayer.locX();
double d5 = d1 - entityplayer.locY(); double d5 = d1 - entityplayer.locY();
@@ -740,23 +1023,34 @@ @@ -740,23 +1024,34 @@
public void reloadWhitelist() {} public void reloadWhitelist() {}
public void a(EntityPlayer entityplayer, WorldServer worldserver) { public void a(EntityPlayer entityplayer, WorldServer worldserver) {
@ -677,7 +678,7 @@
} }
public int getPlayerCount() { public int getPlayerCount() {
@@ -807,12 +1101,22 @@ @@ -807,12 +1102,22 @@
} }
public void shutdown() { public void shutdown() {
@ -702,7 +703,7 @@
public void sendMessage(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) { public void sendMessage(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) {
this.server.sendMessage(ichatbasecomponent, uuid); this.server.sendMessage(ichatbasecomponent, uuid);
Iterator iterator = this.players.iterator(); Iterator iterator = this.players.iterator();
@@ -840,16 +1144,23 @@ @@ -840,16 +1145,23 @@
} }
@ -730,7 +731,7 @@
Path path = file2.toPath(); Path path = file2.toPath();
if (FileUtils.a(path) && FileUtils.b(path) && path.startsWith(file.getPath()) && file2.isFile()) { if (FileUtils.a(path) && FileUtils.b(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -858,7 +1169,7 @@ @@ -858,7 +1170,7 @@
} }
serverstatisticmanager = new ServerStatisticManager(this.server, file1); serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@ -739,7 +740,7 @@
} }
return serverstatisticmanager; return serverstatisticmanager;
@@ -866,14 +1177,14 @@ @@ -866,14 +1178,14 @@
public AdvancementDataPlayer f(EntityPlayer entityplayer) { public AdvancementDataPlayer f(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUniqueID(); UUID uuid = entityplayer.getUniqueID();
@ -756,7 +757,7 @@
} }
advancementdataplayer.a(entityplayer); advancementdataplayer.a(entityplayer);
@@ -909,13 +1220,20 @@ @@ -909,13 +1221,20 @@
} }
public void reload() { public void reload() {