diff --git a/patches/api/add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/api/add-RespawnFlags-to-PlayerRespawnEvent.patch index 36feb770aa..8cb281d229 100644 --- a/patches/api/add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/api/add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -9,28 +9,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java @@ -0,0 +0,0 @@ public class PlayerRespawnEvent extends PlayerEvent { - private Location respawnLocation; private final boolean isBedSpawn; private final boolean isAnchorSpawn; + private final RespawnReason respawnReason; + private final java.util.Set respawnFlags; // Paper @Deprecated public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn) { - this(respawnPlayer, respawnLocation, isBedSpawn, false); +@@ -0,0 +0,0 @@ public class PlayerRespawnEvent extends PlayerEvent { + this(respawnPlayer, respawnLocation, isBedSpawn, false, RespawnReason.PLUGIN); } + @Deprecated // Paper - public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn) { + public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason) { + // Paper start -+ this(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, com.google.common.collect.ImmutableSet.builder()); ++ this(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, respawnReason, com.google.common.collect.ImmutableSet.builder()); + } + -+ public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final com.google.common.collect.ImmutableSet.Builder respawnFlags) { ++ public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason, @NotNull final com.google.common.collect.ImmutableSet.Builder respawnFlags) { + // Paper end super(respawnPlayer); this.respawnLocation = respawnLocation; this.isBedSpawn = isBedSpawn; this.isAnchorSpawn = isAnchorSpawn; + this.respawnReason = respawnReason; + // Paper start + if (this.isBedSpawn) { respawnFlags.add(RespawnFlag.BED_SPAWN); } + if (this.isAnchorSpawn) { respawnFlags.add(RespawnFlag.ANCHOR_SPAWN); } @@ -40,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @@ -0,0 +0,0 @@ public class PlayerRespawnEvent extends PlayerEvent { - public static HandlerList getHandlerList() { - return handlers; + */ + PLUGIN; } + + // Paper start diff --git a/patches/server/Configurable-inter-world-teleportation-safety.patch b/patches/server/Configurable-inter-world-teleportation-safety.patch index 01dc8fa960..56f926c29b 100644 --- a/patches/server/Configurable-inter-world-teleportation-safety.patch +++ b/patches/server/Configurable-inter-world-teleportation-safety.patch @@ -20,11 +20,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - if (fromWorld == toWorld) { entity.connection.teleport(to); } else { -- server.getHandle().respawn(entity, toWorld, true, to, true); -+ server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck); // Paper + // The respawn reason should never be used if the passed location is non null. +- server.getHandle().respawn(entity, toWorld, true, to, true, null); ++ server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper } return true; } diff --git a/patches/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch b/patches/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch index af779aad9e..e4505a6564 100644 --- a/patches/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch +++ b/patches/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch @@ -29,8 +29,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } Player respawnPlayer = entityplayer1.getBukkitEntity(); -- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2); -+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn); // Paper - Fix anchor respawn acting as a bed respawn from the end portal +- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2, reason); ++ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason); // Paper - Fix anchor respawn acting as a bed respawn from the end portal this.cserver.getPluginManager().callEvent(respawnEvent); // Spigot Start if (entityplayer.connection.isDisconnected()) { diff --git a/patches/server/More-Teleport-API.patch b/patches/server/More-Teleport-API.patch index cb558468a8..d24dd35627 100644 --- a/patches/server/More-Teleport-API.patch +++ b/patches/server/More-Teleport-API.patch @@ -211,5 +211,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - entity.connection.teleport(to); + entity.connection.internalTeleport(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), relativeArguments); // Paper - Teleport API } else { - server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck); // Paper - } + // The respawn reason should never be used if the passed location is non null. + server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper diff --git a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch index 8e20eeb450..ef10a6d41e 100644 --- a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.player = this.server.getPlayerList().respawn(this.player, false); + this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - ((GameRules.BooleanValue) this.player.getLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); diff --git a/patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch index 3e8d6157f8..9a053abeb3 100644 --- a/patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; -- this.player = this.server.getPlayerList().respawn(this.player, true); -+ this.player = this.server.getPlayerList().respawn(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL); // Paper - add isEndCreditsRespawn argument +- this.player = this.server.getPlayerList().respawn(this.player, true, RespawnReason.END_PORTAL); ++ this.player = this.server.getPlayerList().respawn(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, RespawnReason.END_PORTAL, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL); // Paper - add isEndCreditsRespawn argument CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { @@ -24,12 +24,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class PlayerList { } - public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation) { + public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) { + // Paper start -+ return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]); ++ return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, reason, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]); + } + -+ public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag...respawnFlags) { ++ public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag...respawnFlags) { + // Paper end entityplayer.stopRiding(); // CraftBukkit this.players.remove(entityplayer); @@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } Player respawnPlayer = entityplayer1.getBukkitEntity(); -- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn); // Paper - Fix anchor respawn acting as a bed respawn from the end portal -+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, com.google.common.collect.ImmutableSet.builder().add(respawnFlags)); // Paper - Fix anchor respawn acting as a bed respawn from the end portal +- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason); // Paper - Fix anchor respawn acting as a bed respawn from the end portal ++ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason, com.google.common.collect.ImmutableSet.builder().add(respawnFlags)); // Paper - Fix anchor respawn acting as a bed respawn from the end portal this.cserver.getPluginManager().callEvent(respawnEvent); // Spigot Start if (entityplayer.connection.isDisconnected()) { diff --git a/patches/server/additions-to-PlayerGameModeChangeEvent.patch b/patches/server/additions-to-PlayerGameModeChangeEvent.patch index 6de248a307..364c8ba1f1 100644 --- a/patches/server/additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/additions-to-PlayerGameModeChangeEvent.patch @@ -134,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.player = this.server.getPlayerList().respawn(this.player, false); + this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { - this.player.setGameMode(GameType.SPECTATOR); + this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper diff --git a/work/Bukkit b/work/Bukkit index de5ba4022d..13eb414669 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit de5ba4022d0775b318799a4ab9d076df2d433de2 +Subproject commit 13eb41466918e64be98fccf96fd3c75c3ea07ae4 diff --git a/work/CraftBukkit b/work/CraftBukkit index 50ee87fbcb..5ee3419b79 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 50ee87fbcb037e4c9bf184d65959089f169ae449 +Subproject commit 5ee3419b794bc7f9235c234d762dbc7da05cb127 diff --git a/work/Spigot b/work/Spigot index d2fdfe3915..514cf03ae9 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit d2fdfe39154577ac5ee1dac1672eab79a9577dc2 +Subproject commit 514cf03ae91c086bf9e47825379698b3a97b6326