From 0b2b5ecc336e36e24c9f660038c6933e514a4a72 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Wed, 25 Jul 2018 21:49:43 -0500
Subject: [PATCH] Remove deprecated AuthLib API from Paper-API
Use the PlayerProfile API as a replacement
---
...low-plugins-to-use-SLF4J-for-logging.patch | 2 +-
.../Profile-Lookup-Events.patch | 100 +++++-------------
.../ProfileWhitelistVerifyEvent.patch | 12 +--
...to-control-if-armour-stands-can-move.patch | 6 +-
4 files changed, 31 insertions(+), 89 deletions(-)
diff --git a/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch b/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch
index b522275490..f279ab7b9a 100644
--- a/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch
+++ b/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch
@@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction.
diff --git a/pom.xml b/pom.xml
-index bfe580f1..5167f5b9 100644
+index a58d4424..a771e156 100644
--- a/pom.xml
+++ b/pom.xml
@@ -0,0 +0,0 @@
diff --git a/Spigot-API-Patches/Profile-Lookup-Events.patch b/Spigot-API-Patches/Profile-Lookup-Events.patch
index 68103b02a1..2f40b58821 100644
--- a/Spigot-API-Patches/Profile-Lookup-Events.patch
+++ b/Spigot-API-Patches/Profile-Lookup-Events.patch
@@ -6,34 +6,15 @@ Subject: [PATCH] Profile Lookup Events
Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in profile data, and cache the responses from
profiles that had to be looked up.
-diff --git a/pom.xml b/pom.xml
-index a58d4424..bfe580f1 100644
---- a/pom.xml
-+++ b/pom.xml
-@@ -0,0 +0,0 @@
-
- provided
-
-+
-+
-+ com.mojang
-+ authlib
-+ 1.5.25
-+ compile
-+
-
- co.aikar
- fastutil-lite
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
new file mode 100644
-index 00000000..3b6995a7
+index 00000000..160c98fe
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.event.profile;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
-+import com.mojang.authlib.GameProfile;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
@@ -60,16 +41,6 @@ index 00000000..3b6995a7
+
+ /**
+ * @return The profile that was recently looked up. This profile can be mutated
-+ * @deprecated will be removed with 1.13, use {@link #getPlayerProfile()}
-+ */
-+ @Deprecated
-+ @Nonnull
-+ public GameProfile getProfile() {
-+ return profile.getGameProfile();
-+ }
-+
-+ /**
-+ * @return The profile that was recently looked up. This profile can be mutated
+ */
+ @Nonnull
+ public PlayerProfile getPlayerProfile() {
@@ -87,7 +58,7 @@ index 00000000..3b6995a7
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
new file mode 100644
-index 00000000..aa0666d5
+index 00000000..e5a5986a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
@@ -0,0 +0,0 @@
@@ -96,8 +67,6 @@ index 00000000..aa0666d5
+import com.destroystokyo.paper.profile.PlayerProfile;
+import com.destroystokyo.paper.profile.ProfileProperty;
+import com.google.common.collect.ArrayListMultimap;
-+import com.google.common.collect.Multimap;
-+import com.mojang.authlib.properties.Property;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
@@ -162,48 +131,6 @@ index 00000000..aa0666d5
+ }
+
+ /**
-+ * Get the properties for this profile
-+ *
-+ * @return the property map to attach to the new {@link PlayerProfile}
-+ * @deprecated will be removed with 1.13 Use {@link #getProfileProperties()}
-+ */
-+ @Deprecated
-+ @Nonnull
-+ public Multimap getProperties() {
-+ Multimap props = ArrayListMultimap.create();
-+
-+ for (ProfileProperty property : properties) {
-+ props.put(property.getName(), new Property(property.getName(), property.getValue(), property.getSignature()));
-+ }
-+ return props;
-+ }
-+
-+ /**
-+ * Completely replaces all Properties with the new provided properties
-+ * @param properties the properties to set on the new profile
-+ * @deprecated will be removed with 1.13 Use {@link #setProfileProperties(Set)}
-+ */
-+ @Deprecated
-+ public void setProperties(Multimap properties) {
-+ this.properties = new HashSet<>();
-+ properties.values().forEach(property -> {
-+ this.properties.add(new ProfileProperty(property.getName(), property.getValue(), property.getSignature()));
-+ });
-+ }
-+
-+ /**
-+ * Adds additional properties, without removing the original properties
-+ * @param properties the properties to add to the existing properties
-+ * @deprecated will be removed with 1.13 use {@link #addProfileProperties(Set)}
-+ */
-+ @Deprecated
-+ public void addProperties(Multimap properties) {
-+ properties.values().forEach(property -> {
-+ this.properties.add(new ProfileProperty(property.getName(), property.getValue(), property.getSignature()));
-+ });
-+ }
-+
-+ /**
+ * @return The currently pending prepopulated properties.
+ * Any property in this Set will be automatically prefilled on this Profile
+ */
@@ -240,4 +167,27 @@ index 00000000..aa0666d5
+ }
+
+}
+diff --git a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
+index e060c38a..1a69e5f7 100644
+--- a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
++++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
+@@ -0,0 +0,0 @@
+ package com.destroystokyo.paper.profile;
+
+-import com.mojang.authlib.GameProfile;
+-
+ import javax.annotation.Nonnull;
+ import javax.annotation.Nullable;
+ import java.util.Collection;
+@@ -0,0 +0,0 @@ public interface PlayerProfile {
+ default boolean hasTextures() {
+ return hasProperty("textures");
+ }
+-
+- /**
+- * @deprecated Will be removed in 1.13
+- */
+- @Deprecated
+- GameProfile getGameProfile();
+ }
--
\ No newline at end of file
diff --git a/Spigot-API-Patches/ProfileWhitelistVerifyEvent.patch b/Spigot-API-Patches/ProfileWhitelistVerifyEvent.patch
index ac07692b4b..d7f8202518 100644
--- a/Spigot-API-Patches/ProfileWhitelistVerifyEvent.patch
+++ b/Spigot-API-Patches/ProfileWhitelistVerifyEvent.patch
@@ -9,7 +9,7 @@ Allows you to do dynamic whitelisting and change of kick message
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
new file mode 100644
-index 00000000..662e79e3
+index 00000000..a11f811e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
@@ -0,0 +0,0 @@
@@ -39,7 +39,6 @@ index 00000000..662e79e3
+package com.destroystokyo.paper.event.profile;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
-+import com.mojang.authlib.GameProfile;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
@@ -81,15 +80,6 @@ index 00000000..662e79e3
+ }
+
+ /**
-+ * The gameprofile of the player trying to connect
-+ * @deprecated Will be removed in 1.13, use #{@link #getPlayerProfile()}
-+ */
-+ @Deprecated
-+ public GameProfile getProfile() {
-+ return profile.getGameProfile();
-+ }
-+
-+ /**
+ * @return The profile of the player trying to connect
+ */
+ public PlayerProfile getPlayerProfile() {
diff --git a/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch
index b72c9056b2..0c629d65a6 100644
--- a/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch
+++ b/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
-index cf11a2225b..578d966401 100644
+index cf11a2225..578d96640 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
@@ -31,7 +31,7 @@ index cf11a2225b..578d966401 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
-index 2b66a08ade..8a06cb1656 100644
+index 2b66a08ad..124c3185b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -0,0 +0,0 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
@@ -39,6 +39,7 @@ index 2b66a08ade..8a06cb1656 100644
getHandle().setMarker(marker);
}
+
++ // Paper start
+ @Override
+ public boolean canMove() {
+ return getHandle().canMove;
@@ -48,5 +49,6 @@ index 2b66a08ade..8a06cb1656 100644
+ public void setCanMove(boolean move) {
+ getHandle().canMove = move;
+ }
++ // Paper end
}
--
\ No newline at end of file