testserver/patches/server/0655-add-RespawnFlags-to-Pl...

46 lines
3.4 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
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
2021-06-15 02:59:31 +00:00
index b154aa2d151babbe4341c6dbaec1753d1472215c..e896057274434eea97d78777dcf303fd83e9cd79 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
2021-06-15 02:59:31 +00:00
@@ -2461,7 +2461,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
2021-06-11 12:02:28 +00:00
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
- this.player = this.server.getPlayerList().respawn(this.player, true);
+ this.player = this.server.getPlayerList().moveToWorld(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, 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
2021-06-15 02:59:31 +00:00
index 508fdb0b07bc4e45c630a2c4b731ffdaa3a5711a..34de9e2b0e52eb7a7e993678fd54ac1b883be4aa 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
2021-06-15 02:59:31 +00:00
@@ -800,6 +800,12 @@ public abstract class PlayerList {
2021-06-11 12:02:28 +00:00
}
public ServerPlayer moveToWorld(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation) {
2021-06-15 02:59:31 +00:00
+ // Paper start
2021-06-11 12:02:28 +00:00
+ return moveToWorld(entityplayer, worldserver, flag, location, avoidSuffocation, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]);
+ }
+
+ public ServerPlayer moveToWorld(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, 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
2021-06-15 02:59:31 +00:00
@@ -890,7 +896,7 @@ public abstract class PlayerList {
2021-06-11 12:02:28 +00:00
}
2021-06-15 02:59:31 +00:00
Player respawnPlayer = this.cserver.getPlayer(entityplayer1);
2021-06-11 12:02:28 +00:00
- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn); // Paper - Fix anchor respawn acting as a bed respawn from the end portal
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, 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
2021-06-15 02:59:31 +00:00
this.cserver.getPluginManager().callEvent(respawnEvent);
2021-06-11 12:02:28 +00:00
// Spigot Start
if (entityplayer.connection.isDisconnected()) {