aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0512-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
blob: 017cc4e93e19dde79dd09e16af353ecaca842383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
index f046b8e6307079878d94eab615a5463a807e6c6c..c22dce8b30c8af3e37b497b0d97c6ceef0295883 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1447,7 +1447,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
         Player respawnPlayer = this.getBukkitEntity();
         Location location = CraftLocation.toBukkit(teleportTransition.position(), teleportTransition.newLevel().getWorld(), teleportTransition.yRot(), teleportTransition.xRot());
 
-        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()) {