2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2024-01-19 17:54:05 +01:00
|
|
|
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
|
|
|
Date: Fri, 23 Apr 2021 22:42:42 +0100
|
|
|
|
Subject: [PATCH] Expand PlayerRespawnEvent, fix passed parameter issues
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2024-01-19 17:54:05 +01:00
|
|
|
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
2024-04-23 19:02:08 +02:00
|
|
|
index d0409856a3aee811714c9254f4436b7f6bb94bf0..872e59c5de3a98bbdf40cf6d2aeb0694f2b88689 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
2024-02-22 17:23:15 +01:00
|
|
|
@@ -2632,7 +2632,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
2021-06-11 14:02:28 +02:00
|
|
|
case PERFORM_RESPAWN:
|
|
|
|
if (this.player.wonGame) {
|
|
|
|
this.player.wonGame = false;
|
2023-04-10 10:03:36 +02:00
|
|
|
- this.player = this.server.getPlayerList().respawn(this.player, true, RespawnReason.END_PORTAL);
|
2024-01-19 17:54:05 +01:00
|
|
|
+ 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
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
index 563e287cfb885f212ebe9dfc8309aa123713897a..e913acef00c0a1a2f49779800b46997588b46253 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -780,6 +780,12 @@ public abstract class PlayerList {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2023-04-10 10:03:36 +02:00
|
|
|
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper start - Expand PlayerRespawnEvent
|
2023-04-10 10:03:36 +02:00
|
|
|
+ return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, reason, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
2023-04-10 10:03:36 +02:00
|
|
|
+ public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag...respawnFlags) {
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper end - Expand PlayerRespawnEvent
|
2021-06-11 14:02:28 +02:00
|
|
|
entityplayer.stopRiding(); // CraftBukkit
|
|
|
|
this.players.remove(entityplayer);
|
|
|
|
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -821,6 +827,7 @@ public abstract class PlayerList {
|
2024-01-19 17:54:05 +01:00
|
|
|
|
2024-01-21 13:56:22 +01:00
|
|
|
// Paper start - Add PlayerPostRespawnEvent
|
2024-01-19 17:54:05 +01:00
|
|
|
boolean isBedSpawn = false;
|
|
|
|
+ boolean isAnchorSpawn = false; // Paper - Fix PlayerRespawnEvent
|
|
|
|
boolean isRespawn = false;
|
|
|
|
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
|
2024-01-21 13:56:22 +01:00
|
|
|
// Paper end - Add PlayerPostRespawnEvent
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -841,6 +848,7 @@ public abstract class PlayerList {
|
2024-01-19 17:54:05 +01:00
|
|
|
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;
|
|
|
|
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -869,7 +877,7 @@ public abstract class PlayerList {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-06-20 21:25:59 +02:00
|
|
|
Player respawnPlayer = entityplayer1.getBukkitEntity();
|
2024-01-19 17:54:05 +01:00
|
|
|
- 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
|
2021-06-15 04:59:31 +02:00
|
|
|
this.cserver.getPluginManager().callEvent(respawnEvent);
|
2021-06-11 14:02:28 +02:00
|
|
|
// Spigot Start
|
|
|
|
if (entityplayer.connection.isDisconnected()) {
|