Fix forced respawn with respawn anchor (#8845)

Dieser Commit ist enthalten in:
Jake Potrebic 2023-02-26 09:38:42 -08:00 committet von GitHub
Ursprung 2f953a8843
Commit fc072c0954
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
4 geänderte Dateien mit 13 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 290052c0c004047e26870365ca5eeb75eaff6371..5d6128932e1af0445cf928fac6d6b91226a18de6 100644
index 290052c0c004047e26870365ca5eeb75eaff6371..9c23f4ee8c3f7a4126261ddc3c80708724757064 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -773,6 +773,7 @@ public abstract class PlayerList {
@ -44,7 +44,7 @@ index 290052c0c004047e26870365ca5eeb75eaff6371..5d6128932e1af0445cf928fac6d6b912
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper
} else {
@@ -867,8 +873,12 @@ public abstract class PlayerList {
@@ -867,8 +873,14 @@ public abstract class PlayerList {
}
// entityplayer1.initInventoryMenu();
entityplayer1.setHealth(entityplayer1.getHealth());
@ -52,8 +52,10 @@ index 290052c0c004047e26870365ca5eeb75eaff6371..5d6128932e1af0445cf928fac6d6b912
- entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong()));
+ // Paper start - Fix SPIGOT-5989
+ if (flag2 && !isLocAltered) {
+ BlockState data = worldserver1.getBlockState(blockposition);
+ worldserver1.setBlock(blockposition, data.setValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE, data.getValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE) - 1), 3);
+ if (!flag1) {
+ BlockState data = worldserver1.getBlockState(blockposition);
+ worldserver1.setBlock(blockposition, data.setValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE, data.getValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE) - 1), 3);
+ }
+ entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) location.getX(), (double) location.getY(), (double) location.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong()));
+ // Paper end
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3d05b2f37b192bf707414f4a574f79423b0f0be1..ad6a9e238d21a821e7d5c3634fbc8fc9bdfc38a3 100644
index 58334842b0fd3d7d69f4946038fc163867c75339..a25181642210cfa30fa1add4a4570d7a8cd3e59e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1063,6 +1063,11 @@ public abstract class PlayerList {
@@ -1065,6 +1065,11 @@ public abstract class PlayerList {
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
@ -20,7 +20,7 @@ index 3d05b2f37b192bf707414f4a574f79423b0f0be1..ad6a9e238d21a821e7d5c3634fbc8fc9
if (player.connection != null) {
byte b0;
@@ -1077,8 +1082,10 @@ public abstract class PlayerList {
@@ -1079,8 +1084,10 @@ public abstract class PlayerList {
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}

Datei anzeigen

@ -434,7 +434,7 @@ index 9a2d9bcad94612e5c2506db5a9dcd4a3f9271a59..6c166950247118cb1bbae4aa1fc3ee8a
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 565a75e5e775edf604cdb4b991b17fb3ca3423ab..adb546d97810b0a4f25568c8a5e50d01bdcfb274 100644
index f54873b3f1fa9a5181d1fe6d1673d6c54de05b72..fede2a6f68de79783f3aa0fd9276a28479dfea48 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -657,7 +657,7 @@ public abstract class PlayerList {
@ -446,7 +446,7 @@ index 565a75e5e775edf604cdb4b991b17fb3ca3423ab..adb546d97810b0a4f25568c8a5e50d01
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1291,8 +1291,8 @@ public abstract class PlayerList {
@@ -1293,8 +1293,8 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Use username instead of display name in
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0093be36b2d107549da99d51894f7a332af5e3fa..c092bfa679c60fd11eb95aaa4828b4f3403869f8 100644
index 2a1273d560279b97faeaa3c906e60cc51c356fce..2bd6cf60e2489b55b17e9245bc1481823ced7785 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1407,7 +1407,7 @@ public abstract class PlayerList {
@@ -1409,7 +1409,7 @@ public abstract class PlayerList {
// CraftBukkit start
public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) {
ServerStatsCounter serverstatisticmanager = entityhuman.getStats();