mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
46 lines
3.5 KiB
Diff
46 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Thu, 22 Apr 2021 17:17:47 -0700
|
|
Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 91e1a5fb981dd8468bb13098424b54da1c90a998..206c0a1e783699ed272e3640a29fe349eb0b465e 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2644,7 +2644,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 - add isEndCreditsRespawn argument
|
|
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 af1c4caa17e8b6ae597af123abe6b056bd8fd87d..c3e058cb24fc6cf3e7508ad689af9214d9a20f7d 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -781,6 +781,12 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
|
|
+ // Paper start
|
|
+ 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
|
|
entityplayer.stopRiding(); // CraftBukkit
|
|
this.players.remove(entityplayer);
|
|
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
|
@@ -872,7 +878,7 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
Player respawnPlayer = entityplayer1.getBukkitEntity();
|
|
- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason); // Paper - Fix anchor respawn acting as a bed respawn from the end portal
|
|
+ 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 - Fix anchor respawn acting as a bed respawn from the end portal
|
|
this.cserver.getPluginManager().callEvent(respawnEvent);
|
|
// Spigot Start
|
|
if (entityplayer.connection.isDisconnected()) {
|