Fix kicking player when they die on a vehicle with instant respawn

The respawn logic apparently can fire before the death is broadcasted
This commit is contained in:
Spottedleaf 2023-03-10 20:11:08 -08:00
parent e1ad1b1d91
commit f6d776697b
2 changed files with 13 additions and 5 deletions

View File

@ -15007,7 +15007,7 @@ index 714637cdd9dcdbffa344b19e77944fb3c7541ff7..80ff2f28521f3d6d00ff21fbe76ab4e9
for (ServerPlayer player : ServerLevel.this.players) {
player.getBukkitEntity().onEntityRemove(entity);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 869daafbc236b3ff63f878e5fe28427fde75afe5..ab060fe03c4c66a2bd0966679b503965849273fa 100644
index 869daafbc236b3ff63f878e5fe28427fde75afe5..8cceb1031763bee4b791795534130112a24a613e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -181,7 +181,7 @@ import org.bukkit.inventory.MainHand;
@ -15162,7 +15162,7 @@ index 869daafbc236b3ff63f878e5fe28427fde75afe5..ab060fe03c4c66a2bd0966679b503965
return horizontalSpawnArea <= 16 ? horizontalSpawnArea - 1 : 17;
}
@@ -1147,6 +1189,339 @@ public class ServerPlayer extends Player {
@@ -1147,6 +1189,343 @@ public class ServerPlayer extends Player {
}
}
@ -15211,6 +15211,10 @@ index 869daafbc236b3ff63f878e5fe28427fde75afe5..ab060fe03c4c66a2bd0966679b503965
+ throw new IllegalStateException("isAlive expected = " + alive);
+ }
+
+ if (!this.hasNullCallback()) {
+ this.unRide();
+ }
+
+ if (this.isVehicle() || this.isPassenger()) {
+ throw new IllegalStateException("Dead player should not be a vehicle or passenger");
+ }
@ -15502,7 +15506,7 @@ index 869daafbc236b3ff63f878e5fe28427fde75afe5..ab060fe03c4c66a2bd0966679b503965
@Nullable
@Override
public Entity changeDimension(ServerLevel destination) {
@@ -2098,6 +2473,12 @@ public class ServerPlayer extends Player {
@@ -2098,6 +2477,12 @@ public class ServerPlayer extends Player {
if (entity1 == entity) return; // new spec target is the current spec target
@ -15515,7 +15519,7 @@ index 869daafbc236b3ff63f878e5fe28427fde75afe5..ab060fe03c4c66a2bd0966679b503965
if (entity == this) {
com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
@@ -2132,7 +2513,7 @@ public class ServerPlayer extends Player {
@@ -2132,7 +2517,7 @@ public class ServerPlayer extends Player {
this.getBukkitEntity().teleport(new Location(entity.getCommandSenderWorld().getWorld(), entity.getX(), entity.getY(), entity.getZ(), this.getYRot(), this.getXRot()), TeleportCause.SPECTATE); // Correctly handle cross-world entities from api calls by using CB teleport
// Make sure we're tracking the entity before sending
@ -15524,7 +15528,7 @@ index 869daafbc236b3ff63f878e5fe28427fde75afe5..ab060fe03c4c66a2bd0966679b503965
if (tracker != null) { // dumb plugins...
tracker.updatePlayer(this);
}
@@ -2567,7 +2948,7 @@ public class ServerPlayer extends Player {
@@ -2567,7 +2952,7 @@ public class ServerPlayer extends Player {
this.experienceLevel = this.newLevel;
this.totalExperience = this.newTotalExp;
this.experienceProgress = 0;

View File

@ -1,6 +1,10 @@
Get done before testing:
- Mob#getTarget?
- regioniser->regionaliser
- infinite radius task may be executed in parallel with non-infinite tasks, as there is no
executing count check
- beehive block crashes server when spawning
- redstone wire accross regions
Pre-Test: List of things not fully tested
- Task queue