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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index fffd3ae6c4fc0b86057cd915bb4f0987f41a64d0..52a5274fb811870481a48bf0505769d7ac5df31f 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1195,7 +1195,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { Player respawnPlayer = this.getBukkitEntity(); Location location = CraftLocation.toBukkit(dimensionTransition.pos(), dimensionTransition.newLevel().getWorld(), dimensionTransition.yRot(), dimensionTransition.xRot()); - PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason); + // Paper start - respawn flags + com.google.common.collect.ImmutableSet.Builder 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()) {