mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-14 14:45:40 +01:00
0cdce89d59
If a playerdata doesn't contain a valid, loaded world, reset to the main world spawn point
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 b1f7227cb63491f5899b9b9d8413715924d1b967..1c795202f3b5be8f7ee41724258b509aa5b1947d 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2628,7 +2628,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 289e5609b74c254ca95680eaf592bdcdb253c9ce..80e31db0fbcac487f8dec943972204cddd10e161 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -785,6 +785,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
|
|
@@ -876,7 +882,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()) {
|