PaperMC/patches/server/0511-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch

27 lines
1.8 KiB
Diff
Raw Normal View History

2024-06-13 23:42:02 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2024-12-05 11:18:29 +01:00
index 82921c10beee7c37994881618c508fc3a14834eb..0e4fe0a2a160c4965cdbfe3d6d375a66c129894d 100644
2024-06-13 23:42:02 +02:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2024-12-03 19:54:10 +01:00
@@ -1447,7 +1447,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
2024-06-13 23:42:02 +02:00
Player respawnPlayer = this.getBukkitEntity();
2024-10-23 20:15:25 +02:00
Location location = CraftLocation.toBukkit(teleportTransition.position(), teleportTransition.newLevel().getWorld(), teleportTransition.yRot(), teleportTransition.xRot());
2024-06-13 23:42:02 +02:00
- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason);
+ // Paper start - respawn flags
+ com.google.common.collect.ImmutableSet.Builder<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag> builder = com.google.common.collect.ImmutableSet.builder();
+ if (reason == org.bukkit.event.player.PlayerRespawnEvent.RespawnReason.END_PORTAL) {
+ builder.add(org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL);
+ }
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason, builder);
+ // Paper end - respawn flags
this.level().getCraftServer().getPluginManager().callEvent(respawnEvent);
// Spigot Start
if (this.connection.isDisconnected()) {