aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0545-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
diff options
context:
space:
mode:
authormaxcom1 <[email protected]>2024-03-23 22:26:17 +0100
committerGitHub <[email protected]>2024-03-23 17:26:17 -0400
commitb6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch)
treea8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0545-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
parent9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff)
downloadPaper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz
Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0545-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch')
-rw-r--r--patches/server/0545-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/patches/server/0545-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch b/patches/server/0545-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
new file mode 100644
index 0000000000..95d33b962c
--- /dev/null
+++ b/patches/server/0545-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
@@ -0,0 +1,62 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: HexedHero <[email protected]>
+Date: Fri, 23 Apr 2021 22:42:42 +0100
+Subject: [PATCH] Expand PlayerRespawnEvent, fix passed parameter issues
+
+Co-authored-by: Jake Potrebic <[email protected]>
+
+diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+index 12b81d6dc04586d2491a382b6198f986b2b5bae1..e12740f601acbe2b344d8e1fffc4bee2c752face 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -2632,7 +2632,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+ 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 - Expand PlayerRespawnEvent
+ 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 563e287cfb885f212ebe9dfc8309aa123713897a..e913acef00c0a1a2f49779800b46997588b46253 100644
+--- a/src/main/java/net/minecraft/server/players/PlayerList.java
++++ b/src/main/java/net/minecraft/server/players/PlayerList.java
+@@ -780,6 +780,12 @@ public abstract class PlayerList {
+ }
+
+ public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
++ // Paper start - Expand PlayerRespawnEvent
++ 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 - Expand PlayerRespawnEvent
+ entityplayer.stopRiding(); // CraftBukkit
+ this.players.remove(entityplayer);
+ this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
+@@ -821,6 +827,7 @@ public abstract class PlayerList {
+
+ // Paper start - Add PlayerPostRespawnEvent
+ boolean isBedSpawn = false;
++ boolean isAnchorSpawn = false; // Paper - Fix PlayerRespawnEvent
+ boolean isRespawn = false;
+ boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
+ // Paper end - Add PlayerPostRespawnEvent
+@@ -841,6 +848,7 @@ public abstract class PlayerList {
+ if (optional.isPresent()) {
+ BlockState iblockdata = worldserver1.getBlockState(blockposition);
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
++ isAnchorSpawn = flag3; // Paper - Fix PlayerRespawnEvent
+ Vec3 vec3d = (Vec3) optional.get();
+ float f1;
+
+@@ -869,7 +877,7 @@ public abstract class PlayerList {
+ }
+
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
+- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2, reason);
++ 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 - PlayerRespawnEvent changes
+ this.cserver.getPluginManager().callEvent(respawnEvent);
+ // Spigot Start
+ if (entityplayer.connection.isDisconnected()) {