13
0
geforkt von Mirrors/Paper

Restore Player#refreshPlayer (Fixes #3650)

untested, don't @ me
Dieser Commit ist enthalten in:
Shane Freeder 2020-06-28 12:16:36 +01:00
Ursprung 86ee6c968c
Commit 4da9f70a50
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C
10 geänderte Dateien mit 39 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -48,7 +48,7 @@ index 80a21dbc05ed3007f2e827f7a320131244c3044b..e0f0a1e91a037f93b239e779aa8fd92b
uniqueId = i.getId();
// Paper end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f27fb59e752d25807859396560b213162870998e..53c52e4922538f1dd50764d8cbaa178d1f0692f9 100644
index f27fb59e752d25807859396560b213162870998e..9718dd56217dd64f51ea399b4ecf57528eb89e89 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,6 +1,8 @@
@ -68,7 +68,15 @@ index f27fb59e752d25807859396560b213162870998e..53c52e4922538f1dd50764d8cbaa178d
import net.minecraft.server.MapIcon;
import net.minecraft.server.MinecraftKey;
import net.minecraft.server.NBTTagCompound;
@@ -1216,8 +1219,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -54,6 +57,7 @@ import net.minecraft.server.PacketPlayOutMap;
import net.minecraft.server.PacketPlayOutNamedSoundEffect;
import net.minecraft.server.PacketPlayOutPlayerInfo;
import net.minecraft.server.PacketPlayOutPlayerListHeaderFooter;
+import net.minecraft.server.PacketPlayOutRespawn;
import net.minecraft.server.PacketPlayOutSpawnPosition;
import net.minecraft.server.PacketPlayOutStopSound;
import net.minecraft.server.PacketPlayOutTitle;
@@ -1216,8 +1220,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
// Remove this player from the hidden player's EntityTrackerEntry
@ -83,7 +91,7 @@ index f27fb59e752d25807859396560b213162870998e..53c52e4922538f1dd50764d8cbaa178d
PlayerChunkMap.EntityTracker entry = tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(getHandle());
@@ -1258,8 +1266,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1258,8 +1267,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
hiddenPlayers.remove(player.getUniqueId());
@ -98,7 +106,7 @@ index f27fb59e752d25807859396560b213162870998e..53c52e4922538f1dd50764d8cbaa178d
getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
@@ -1268,6 +1281,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1268,6 +1282,50 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
entry.updatePlayer(getHandle());
}
}
@ -134,7 +142,8 @@ index f27fb59e752d25807859396560b213162870998e..53c52e4922538f1dd50764d8cbaa178d
+ reregisterPlayer(handle);
+
+ //Respawn the player then update their position and selected slot
+ //connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, net.minecraft.server.WorldData.c(handle.world.getWorldData().getSeed()), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode())); // TODO: Fix this if you care to make it work
+ WorldServer worldserver = handle.getWorldServer();
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(worldserver.getTypeKey(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
+ handle.updateAbilities();
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle);

Datei anzeigen

@ -9,10 +9,10 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 53c52e4922538f1dd50764d8cbaa178d1f0692f9..b5d2ce40431247112baaded01e860c1832bf8fd8 100644
index 9718dd56217dd64f51ea399b4ecf57528eb89e89..61d4f52f97a9404b1ba10ceaa25c5f79be8b2a9f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -142,6 +142,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -143,6 +143,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start
private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus;
private String resourcePackHash;
@ -20,7 +20,7 @@ index 53c52e4922538f1dd50764d8cbaa178d1f0692f9..b5d2ce40431247112baaded01e860c18
// Paper end
public CraftPlayer(CraftServer server, EntityPlayer entity) {
@@ -1486,7 +1487,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1488,7 +1489,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void addChannel(String channel) {

Datei anzeigen

@ -101,7 +101,7 @@ index 351eeb83d8a28b19e3805f0d8a377f4ed060c592..027f9a86f458aab7d94f132981a9c700
this.player.o();
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index edb59cf7dc797384bba9d37f486b624753d4f31c..509451c73892147419ef4cf23b449c61d21cf279 100644
index fbacfe2c825f71b3c8617a3bf022f6793eb64996..31ffa627417745f87917933cb96873fd8657b49a 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -420,7 +420,7 @@ public abstract class PlayerList {
@ -155,10 +155,10 @@ index 27b2ee740a705238995dd3bcea62b4bf74ec82dc..f6209e9c0b9e0ab99693025d23847bc6
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b5d2ce40431247112baaded01e860c1832bf8fd8..bb6635be243a270752e1c47a9646a13ea6707baf 100644
index 61d4f52f97a9404b1ba10ceaa25c5f79be8b2a9f..2f27b2559977161c5be898a3df928452272b9c3d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -789,7 +789,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -790,7 +790,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory
if (getHandle().activeContainer != getHandle().defaultContainer) {

Datei anzeigen

@ -27,10 +27,10 @@ index d9e5d71a87140c90b79902887bd2f481f02956dc..afc665bfe9d527ca8d19f3ab9df0900d
this.aA = 0;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index bb6635be243a270752e1c47a9646a13ea6707baf..5412e83e0c531d477e6df99eae8fea645044b1f3 100644
index 2f27b2559977161c5be898a3df928452272b9c3d..417ee5934edc1f17b7186ae920944f9a61b02f34 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1949,6 +1949,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1951,6 +1951,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getInventory().setItemInMainHand(hand);
}

Datei anzeigen

@ -357,10 +357,10 @@ index 7b565ddfffd0b9c78392ee115ef9c20ab89a3380..d78b9fd608da691220f1edeff506b36e
this.minecraftKey = minecraftKey;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5412e83e0c531d477e6df99eae8fea645044b1f3..8ac369d5edf139b2457fa1da03e3473b907976f6 100644
index 417ee5934edc1f17b7186ae920944f9a61b02f34..9e18e3f7819761089f6c908cdb2f4c5afd86d985 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1740,7 +1740,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1742,7 +1742,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void sendHealthUpdate() {

Datei anzeigen

@ -28,7 +28,7 @@ index 76eff7dcb734f366b515d13a4a693adaa23695ad..af4fd8beab932589a832c7f4916bc669
public boolean queueHealthUpdatePacket = false;
public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 7c88e370c19554652d4a580252e657747180047d..139104c436c9a04865ec4138606e82091be8b65f 100644
index 850a88c5b7887baf40787b21c04f40b9809157d7..74eadab4dedce86128cf39fd6c983ffe51c916fa 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -97,6 +97,7 @@ public abstract class PlayerList {
@ -106,10 +106,10 @@ index 00333548b470435aa89fb0f4b29047eb1461e992..5770d4183c1b9ab6119a25930283c023
public Location getBedSpawnLocation() {
NBTTagCompound data = getData();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8ac369d5edf139b2457fa1da03e3473b907976f6..4266884ba7790f673704937305d787d19a61401a 100644
index 9e18e3f7819761089f6c908cdb2f4c5afd86d985..937ac92516b5d27ad080ff0a84b33cc71da4f65d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -143,6 +143,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -144,6 +144,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus;
private String resourcePackHash;
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
@ -117,7 +117,7 @@ index 8ac369d5edf139b2457fa1da03e3473b907976f6..4266884ba7790f673704937305d787d1
// Paper end
public CraftPlayer(CraftServer server, EntityPlayer entity) {
@@ -1390,6 +1391,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1392,6 +1393,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.firstPlayed = firstPlayed;
}
@ -136,7 +136,7 @@ index 8ac369d5edf139b2457fa1da03e3473b907976f6..4266884ba7790f673704937305d787d1
public void readExtraData(NBTTagCompound nbttagcompound) {
hasPlayedBefore = true;
if (nbttagcompound.hasKey("bukkit")) {
@@ -1412,6 +1425,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1414,6 +1427,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setExtraData(NBTTagCompound nbttagcompound) {
@ -145,7 +145,7 @@ index 8ac369d5edf139b2457fa1da03e3473b907976f6..4266884ba7790f673704937305d787d1
if (!nbttagcompound.hasKey("bukkit")) {
nbttagcompound.set("bukkit", new NBTTagCompound());
}
@@ -1426,6 +1441,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1428,6 +1443,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.setLong("firstPlayed", getFirstPlayed());
data.setLong("lastPlayed", System.currentTimeMillis());
data.setString("lastKnownName", handle.getName());

Datei anzeigen

@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4266884ba7790f673704937305d787d19a61401a..f05f7cbdb0f42601faab8c68a4c75247bd964823 100644
index 937ac92516b5d27ad080ff0a84b33cc71da4f65d..ed2c4fd43c9bf6ea4e6b647d36e9a5824f9b0b87 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1994,6 +1994,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1996,6 +1996,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetCooldown() {
getHandle().resetCooldown();
}

Datei anzeigen

@ -40,10 +40,10 @@ index 9331f96f68f121b41ce74904d624520291b7c72e..1074995e8c8a83f6cdb94019123fbffa
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f05f7cbdb0f42601faab8c68a4c75247bd964823..cafa091b84caa6b24078962552b6bb34aca284c3 100644
index ed2c4fd43c9bf6ea4e6b647d36e9a5824f9b0b87..61ccd4991c14cdcc05352158e26855ef15c82bd0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2003,6 +2003,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2005,6 +2005,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
super.remove();
}
}

Datei anzeigen

@ -158,7 +158,7 @@ index dbc3552d50c4129e1844c8a379ab5ba396645f52..be97a0b01b3272e01ece90172f283e3f
return this.e;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index cafa091b84caa6b24078962552b6bb34aca284c3..9e26a15746fcdf80b581b81f836d9df51759f601 100644
index 61ccd4991c14cdcc05352158e26855ef15c82bd0..c447e6f9c5ad7a1e58a76884a0c00bbe192671d2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,5 +1,8 @@
@ -170,7 +170,7 @@ index cafa091b84caa6b24078962552b6bb34aca284c3..9e26a15746fcdf80b581b81f836d9df5
import com.destroystokyo.paper.Title;
import com.destroystokyo.paper.profile.CraftPlayerProfile;
import com.destroystokyo.paper.profile.PlayerProfile;
@@ -2013,6 +2016,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2015,6 +2018,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setViewDistance(int viewDistance) {
throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
}

Datei anzeigen

@ -1144,7 +1144,7 @@ index 681de2638eb606185077668d87340f7258e2ad90..fcd30d3fa5bac44ca71714a13917d847
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 477b1920869bfdab166b815f433d2df2821e5d58..a8100f7ade20932a87c55750b412d6a755a9cdd5 100644
index ea2b2fbfe76ec4c86ac3b236c2daad3e75caa9c3..8326ce64ec57d84b768a0cf0d7873f1e1ea68456 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -200,8 +200,8 @@ public abstract class PlayerList {
@ -1231,10 +1231,10 @@ index 8a37871bea36bd34b514428acea1acad2ba5897e..b973bd8f60412232df53ac52d97135de
net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null);
return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9e26a15746fcdf80b581b81f836d9df51759f601..2e2b28b145b50549345be5a9c754302d5e645274 100644
index c447e6f9c5ad7a1e58a76884a0c00bbe192671d2..2faa6dd671df53ac0fa18920773e3ca7425a791e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -742,6 +742,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -743,6 +743,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
}