diff options
Diffstat (limited to 'patches/server/0595-add-RespawnFlags-to-PlayerRespawnEvent.patch')
-rw-r--r-- | patches/server/0595-add-RespawnFlags-to-PlayerRespawnEvent.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/server/0595-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0595-add-RespawnFlags-to-PlayerRespawnEvent.patch new file mode 100644 index 0000000000..e91901fe8e --- /dev/null +++ b/patches/server/0595-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Thu, 22 Apr 2021 17:17:47 -0700 +Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 7451b61d28c22555619a80b741744b376d92ce58..b3a75c6c1639b756084fb880ec085dd3541adcb4 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2780,7 +2780,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + case PERFORM_RESPAWN: + if (this.player.wonGame) { + this.player.wonGame = false; +- 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) { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 10d02d71b67f4022c6d5c709793a11283694362d..8fb526c84850162bbce004dc4179219320634eeb 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -769,6 +769,12 @@ public abstract class PlayerList { + } + + public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) { ++ // Paper start ++ 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, RespawnReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag...respawnFlags) { ++ // Paper end + entityplayer.stopRiding(); // CraftBukkit + this.players.remove(entityplayer); + this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot +@@ -860,7 +866,7 @@ public abstract class PlayerList { + } + + Player respawnPlayer = entityplayer1.getBukkitEntity(); +- 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.<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag>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()) { |