mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 23:57:43 +01:00
Remove deprecated AuthLib API from Paper-API
Use the PlayerProfile API as a replacement
This commit is contained in:
parent
230b8d4258
commit
e64513b585
4 changed files with 40 additions and 98 deletions
|
@ -1,4 +1,4 @@
|
|||
From 960d92e62001a815ee391c27085ed77ac367020f Mon Sep 17 00:00:00 2001
|
||||
From f3b8cae8d19b09d483ade52dd74ee6130ef912e1 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 17 Jun 2017 16:30:44 -0400
|
||||
Subject: [PATCH] Profile Lookup Events
|
||||
|
@ -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
|
||||
@@ -61,6 +61,13 @@
|
||||
<!-- Trove Provided by CraftBukkit -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
+ <!-- Paper - Add Authlib for Profile API -->
|
||||
+ <dependency>
|
||||
+ <groupId>com.mojang</groupId>
|
||||
+ <artifactId>authlib</artifactId>
|
||||
+ <version>1.5.25</version> <!-- keep in sync with major MC versions -->
|
||||
+ <scope>compile</scope> <!-- expose to Plugins -->
|
||||
+ </dependency>
|
||||
<dependency>
|
||||
<groupId>co.aikar</groupId>
|
||||
<artifactId>fastutil-lite</artifactId>
|
||||
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 +1,55 @@
|
||||
@@ -0,0 +1,44 @@
|
||||
+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,17 +58,15 @@ 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 +1,149 @@
|
||||
@@ -0,0 +1,105 @@
|
||||
+package com.destroystokyo.paper.event.profile;
|
||||
+
|
||||
+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<String, Property> getProperties() {
|
||||
+ Multimap<String, Property> 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<String, Property> 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<String, Property> 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,6 +167,29 @@ 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
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.destroystokyo.paper.profile;
|
||||
|
||||
-import com.mojang.authlib.GameProfile;
|
||||
-
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
@@ -140,10 +138,4 @@ public interface PlayerProfile {
|
||||
default boolean hasTextures() {
|
||||
return hasProperty("textures");
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * @deprecated Will be removed in 1.13
|
||||
- */
|
||||
- @Deprecated
|
||||
- GameProfile getGameProfile();
|
||||
}
|
||||
--
|
||||
2.18.0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 71beda67b3983f467674f9b2b65a54e9199fda7a Mon Sep 17 00:00:00 2001
|
||||
From a2f75206786a9be627fbdb0c6e1597b6a38db782 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 3 Jul 2017 18:11:34 -0500
|
||||
Subject: [PATCH] ProfileWhitelistVerifyEvent
|
||||
|
@ -9,10 +9,10 @@ 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 +1,120 @@
|
||||
@@ -0,0 +1,110 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 - Daniel Ennis (Aikar) - MIT License
|
||||
+ *
|
||||
|
@ -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() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 8e55e6baef53dcb9a217b5e3f0169b57a5835bac Mon Sep 17 00:00:00 2001
|
||||
From 1a487d66a8be68e6b9f90eec7cc97a56c465fb32 Mon Sep 17 00:00:00 2001
|
||||
From: Minecrell <minecrell@minecrell.net>
|
||||
Date: Thu, 21 Sep 2017 16:33:12 +0200
|
||||
Subject: [PATCH] Allow plugins to use SLF4J for logging
|
||||
|
@ -14,10 +14,10 @@ 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
|
||||
@@ -121,6 +121,14 @@
|
||||
@@ -114,6 +114,14 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 733a688296bb6dd124969295ffb9238c561d6405 Mon Sep 17 00:00:00 2001
|
||||
From 9552638e5117ea211b9a4d0f6104982070a79281 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 21 Dec 2016 11:47:25 -0600
|
||||
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
|
||||
@@ -44,6 +44,7 @@ public class EntityArmorStand extends EntityLiving {
|
||||
|
@ -31,14 +31,15 @@ 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
|
||||
@@ -211,4 +211,14 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
||||
@@ -211,4 +211,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
||||
public void setMarker(boolean marker) {
|
||||
getHandle().setMarker(marker);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean canMove() {
|
||||
+ return getHandle().canMove;
|
||||
|
@ -48,6 +49,7 @@ index 2b66a08ade..8a06cb1656 100644
|
|||
+ public void setCanMove(boolean move) {
|
||||
+ getHandle().canMove = move;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.18.0
|
||||
|
|
Loading…
Reference in a new issue