aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0637-add-RespawnFlags-to-PlayerRespawnEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0637-add-RespawnFlags-to-PlayerRespawnEvent.patch')
-rw-r--r--patches/server/0637-add-RespawnFlags-to-PlayerRespawnEvent.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/server/0637-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0637-add-RespawnFlags-to-PlayerRespawnEvent.patch
new file mode 100644
index 0000000000..5fff43eeb8
--- /dev/null
+++ b/patches/server/0637-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 f9b817f2ec0f1c390393c4795c28de193636ca68..6764cfef07169db97662177837aa7815f7346a5d 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -2497,7 +2497,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
+ 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
+ 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 1f1d5a1fe4fc567a383e60bd9b0dc69d8da673cb..5d7d1372e012ce609073eecea83232b085c6c404 100644
+--- a/src/main/java/net/minecraft/server/players/PlayerList.java
++++ b/src/main/java/net/minecraft/server/players/PlayerList.java
+@@ -810,6 +810,12 @@ public abstract class PlayerList {
+ }
+
+ public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation) {
++ // Paper start
++ return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, 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) {
++ // Paper end
+ entityplayer.stopRiding(); // CraftBukkit
+ this.players.remove(entityplayer);
+ this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
+@@ -901,7 +907,7 @@ public abstract class PlayerList {
+ }
+
+ 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.<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()) {