From 8c4bc5f8b12e7857ed91452fa15e0ad391764e44 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 22 Feb 2020 14:13:29 +0000
Subject: [PATCH] Do not send PlayerProfile info before initial server send

---
 ...Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch | 8 ++++----
 ...lock-Entity-remove-from-being-called-on-Players.patch | 2 +-
 .../Expose-attack-cooldown-methods-for-Player.patch      | 2 +-
 .../Flag-to-disable-the-channel-limit.patch              | 2 +-
 Spigot-Server-Patches/Improve-death-events.patch         | 2 +-
 .../Per-Player-View-Distance-API-placeholders.patch      | 6 +++---
 Spigot-Server-Patches/Player.setPlayerProfile-API.patch  | 9 ++++++---
 7 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch
index 688088db1d..7128bdbf81 100644
--- a/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch
+++ b/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch
@@ -16,7 +16,7 @@ intent to remove) and replace it with two new methods, clearly named and
 documented as to their purpose.
 
 diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
-index 68e12cf98..d3bfb72e3 100644
+index 68e12cf987..d3bfb72e39 100644
 --- a/src/main/java/net/minecraft/server/EntityPlayer.java
 +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
 @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -28,7 +28,7 @@ index 68e12cf98..d3bfb72e3 100644
      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 e46436623..659ce2181 100644
+index e46436623c..659ce21818 100644
 --- a/src/main/java/net/minecraft/server/PlayerList.java
 +++ b/src/main/java/net/minecraft/server/PlayerList.java
 @@ -0,0 +0,0 @@ public abstract class PlayerList {
@@ -40,7 +40,7 @@ index e46436623..659ce2181 100644
          UserCache usercache = this.server.getUserCache();
          GameProfile gameprofile1 = usercache.getProfile(gameprofile.getId());
 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
-index c1ef1c950..3824180ee 100644
+index c1ef1c950d..3824180ee5 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
 @@ -0,0 +0,0 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
@@ -106,7 +106,7 @@ index c1ef1c950..3824180ee 100644
      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 a2bda708c..37fce38df 100644
+index 878287cf0d..2de233df35 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
diff --git a/Spigot-Server-Patches/Block-Entity-remove-from-being-called-on-Players.patch b/Spigot-Server-Patches/Block-Entity-remove-from-being-called-on-Players.patch
index ff2bb8859e..112a0c09ac 100644
--- a/Spigot-Server-Patches/Block-Entity-remove-from-being-called-on-Players.patch
+++ b/Spigot-Server-Patches/Block-Entity-remove-from-being-called-on-Players.patch
@@ -12,7 +12,7 @@ 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 37fce38df..90c251c90 100644
+index 2de233df35..74a9e8f22e 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
diff --git a/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch b/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch
index 9c31fe91ab..8331293e19 100644
--- a/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch
+++ b/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch
@@ -27,7 +27,7 @@ index 36748ccb73..308ac18f7e 100644
          this.aB = 0;
      }
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index c1f3927164..352ef3669d 100644
+index d7d86a8b24..d584c76ecd 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
diff --git a/Spigot-Server-Patches/Flag-to-disable-the-channel-limit.patch b/Spigot-Server-Patches/Flag-to-disable-the-channel-limit.patch
index 9c16b5174f..71d5705a00 100644
--- a/Spigot-Server-Patches/Flag-to-disable-the-channel-limit.patch
+++ b/Spigot-Server-Patches/Flag-to-disable-the-channel-limit.patch
@@ -9,7 +9,7 @@ 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 c3f8f3f4c..f4affa693 100644
+index 15e33d7627..52640237ae 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
diff --git a/Spigot-Server-Patches/Improve-death-events.patch b/Spigot-Server-Patches/Improve-death-events.patch
index 8e6760bcde..5f23f4da10 100644
--- a/Spigot-Server-Patches/Improve-death-events.patch
+++ b/Spigot-Server-Patches/Improve-death-events.patch
@@ -357,7 +357,7 @@ index 90fdf89c81..b761a41dcd 100644
          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 352ef3669d..a2bda708cd 100644
+index d584c76ecd..878287cf0d 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
diff --git a/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch b/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch
index 6463c06de4..32144bea4c 100644
--- a/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch
+++ b/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch
@@ -7,7 +7,7 @@ I hope to look at this more in-depth soon. It appears doable.
 However this should not block the update.
 
 diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
-index 6a4ccaeb0..af10fc36e 100644
+index 6a4ccaeb0f..af10fc36e0 100644
 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
 +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
 @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
@@ -23,7 +23,7 @@ index 6a4ccaeb0..af10fc36e 100644
                      double deltaX = this.locX() - player.locX();
                      double deltaZ = this.locZ() - player.locZ();
 diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
-index 2e95069c1..8977c3516 100644
+index 2e95069c19..8977c3516b 100644
 --- a/src/main/java/net/minecraft/server/EntityWither.java
 +++ b/src/main/java/net/minecraft/server/EntityWither.java
 @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -39,7 +39,7 @@ index 2e95069c1..8977c3516 100644
                      double deltaX = this.locX() - player.locX();
                      double deltaZ = this.locZ() - player.locZ();
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index 90c251c90..c1acec87f 100644
+index 74a9e8f22e..60f62f19cb 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
diff --git a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch
index cc59daabf3..5983951731 100644
--- a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch
+++ b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch
@@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API
 This can be useful for changing name or skins after a player has logged in.
 
 diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
-index ef9eabb83..0f12f8386 100644
+index 3fe13fe489..60dd8672b1 100644
 --- a/src/main/java/net/minecraft/server/EntityHuman.java
 +++ b/src/main/java/net/minecraft/server/EntityHuman.java
 @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
@@ -19,7 +19,7 @@ index ef9eabb83..0f12f8386 100644
      private final ItemCooldown bW;
      @Nullable
 diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
-index 1b43f9216..1c4ac7bf7 100644
+index 1b43f92164..1c4ac7bf7a 100644
 --- a/src/main/java/net/minecraft/server/LoginListener.java
 +++ b/src/main/java/net/minecraft/server/LoginListener.java
 @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
@@ -48,7 +48,7 @@ index 1b43f9216..1c4ac7bf7 100644
                              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 6f47768c9..c3f8f3f4c 100644
+index 6f47768c9d..15e33d7627 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@
@@ -104,6 +104,9 @@ index 6f47768c9..c3f8f3f4c 100644
 +    public void setPlayerProfile(PlayerProfile profile) {
 +        EntityPlayer self = getHandle();
 +        self.setProfile(CraftPlayerProfile.asAuthlibCopy(profile));
++        if (!self.sentListPacket) {
++            return;
++        }
 +        List<EntityPlayer> players = server.getServer().getPlayerList().players;
 +        for (EntityPlayer player : players) {
 +            player.getBukkitEntity().reregisterPlayer(self);