3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 03:20:07 +01:00

Deprecate usages of authlib

ref #828
Dieser Commit ist enthalten in:
kashike 2017-08-22 19:08:41 -07:00
Ursprung 48d8add662
Commit 85c6f826e4

Datei anzeigen

@ -1,4 +1,4 @@
From cb77703817c58fc10b14faf4fbfaeee5a9f98e7b Mon Sep 17 00:00:00 2001 From bf4c10675dba6aa49c9d4db585c9d70b1da00637 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 17 Jun 2017 16:30:44 -0400 Date: Sat, 17 Jun 2017 16:30:44 -0400
Subject: [PATCH] Profile Lookup Events Subject: [PATCH] Profile Lookup Events
@ -7,7 +7,7 @@ Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in p
profiles that had to be looked up. profiles that had to be looked up.
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index de5bc3f3..293442c3 100644 index 31b6f51b..60e9f910 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -62,6 +62,13 @@ @@ -62,6 +62,13 @@
@ -26,10 +26,10 @@ index de5bc3f3..293442c3 100644
<artifactId>fastutil-lite</artifactId> <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 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 new file mode 100644
index 00000000..6074ecde index 00000000..37e957f4
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
@@ -0,0 +1,43 @@ @@ -0,0 +1,53 @@
+package com.destroystokyo.paper.event.profile; +package com.destroystokyo.paper.event.profile;
+ +
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
@ -49,9 +49,16 @@ index 00000000..6074ecde
+public class LookupProfileEvent extends Event { +public class LookupProfileEvent extends Event {
+ +
+ private static final HandlerList handlers = new HandlerList(); + private static final HandlerList handlers = new HandlerList();
+ + /**
+ * @deprecated will be removed with 1.13
+ */
+ @Deprecated
+ private final GameProfile profile; + private final GameProfile profile;
+ +
+ /**
+ * @deprecated will be removed with 1.13
+ */
+ @Deprecated
+ public LookupProfileEvent(@Nonnull GameProfile profile) { + public LookupProfileEvent(@Nonnull GameProfile profile) {
+ super(!Bukkit.isPrimaryThread()); + super(!Bukkit.isPrimaryThread());
+ this.profile = profile; + this.profile = profile;
@ -59,12 +66,15 @@ index 00000000..6074ecde
+ +
+ /** + /**
+ * @return The profile that was recently looked up. This profile can be mutated + * @return The profile that was recently looked up. This profile can be mutated
+ * @deprecated will be removed with 1.13
+ */ + */
+ @Deprecated
+ @Nonnull + @Nonnull
+ public GameProfile getProfile() { + public GameProfile getProfile() {
+ return profile; + return profile;
+ } + }
+ +
+ @Override
+ public HandlerList getHandlers() { + public HandlerList getHandlers() {
+ return handlers; + return handlers;
+ } + }
@ -75,10 +85,10 @@ index 00000000..6074ecde
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java 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 new file mode 100644
index 00000000..750b9334 index 00000000..455ffaa1
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
@@ -0,0 +1,155 @@ @@ -0,0 +1,170 @@
+package com.destroystokyo.paper.event.profile; +package com.destroystokyo.paper.event.profile;
+ +
+import com.google.common.collect.Multimap; +import com.google.common.collect.Multimap;
@ -110,10 +120,12 @@ index 00000000..750b9334
+public class PreLookupProfileEvent extends Event { +public class PreLookupProfileEvent extends Event {
+ +
+ private static final HandlerList handlers = new HandlerList(); + private static final HandlerList handlers = new HandlerList();
+
+ private final String name; + private final String name;
+
+ private UUID uuid; + private UUID uuid;
+ /**
+ * @deprecated will be removed with 1.13
+ */
+ @Deprecated
+ private PropertyMap properties = new PropertyMap(); + private PropertyMap properties = new PropertyMap();
+ +
+ public PreLookupProfileEvent(@Nonnull String name) { + public PreLookupProfileEvent(@Nonnull String name) {
@ -130,11 +142,11 @@ index 00000000..750b9334
+ } + }
+ +
+ /** + /**
+ * @return The UUID of the profile if it has already been provided by a plugin
+ *
+ * If this value is left null by the completion of the event call, then the server will + * If this value is left null by the completion of the event call, then the server will
+ * trigger a call to the Mojang API to look up the UUID (Network Request), and subsequently, fire a + * trigger a call to the Mojang API to look up the UUID (Network Request), and subsequently, fire a
+ * {@link LookupProfileEvent} + * {@link LookupProfileEvent}
+ *
+ * @return The UUID of the profile if it has already been provided by a plugin
+ */ + */
+ @Nullable + @Nullable
+ public UUID getUUID() { + public UUID getUUID() {
@ -156,7 +168,9 @@ index 00000000..750b9334
+ * Get the properties for this profile + * Get the properties for this profile
+ * + *
+ * @return the property map to attach to the new {@link GameProfile} + * @return the property map to attach to the new {@link GameProfile}
+ * @deprecated will be removed with 1.13
+ */ + */
+ @Deprecated
+ @Nonnull + @Nonnull
+ public Multimap<String, Property> getProperties() { + public Multimap<String, Property> getProperties() {
+ return properties; + return properties;
@ -165,7 +179,9 @@ index 00000000..750b9334
+ /** + /**
+ * Completely replaces all Properties with the new provided properties + * Completely replaces all Properties with the new provided properties
+ * @param properties the properties to set on the new profile + * @param properties the properties to set on the new profile
+ * @deprecated will be removed with 1.13
+ */ + */
+ @Deprecated
+ public void setProperties(Multimap<String, Property> properties) { + public void setProperties(Multimap<String, Property> properties) {
+ this.properties = new PropertyMap(); + this.properties = new PropertyMap();
+ this.properties.putAll(properties); + this.properties.putAll(properties);
@ -174,11 +190,14 @@ index 00000000..750b9334
+ /** + /**
+ * Adds additional properties, without removing the original properties + * Adds additional properties, without removing the original properties
+ * @param properties the properties to add to the existing properties + * @param properties the properties to add to the existing properties
+ * @deprecated will be removed with 1.13
+ */ + */
+ @Deprecated
+ public void addProperties(Multimap<String, Property> properties) { + public void addProperties(Multimap<String, Property> properties) {
+ this.properties.putAll(properties); + this.properties.putAll(properties);
+ } + }
+ +
+ @Override
+ public HandlerList getHandlers() { + public HandlerList getHandlers() {
+ return handlers; + return handlers;
+ } + }
@ -187,9 +206,11 @@ index 00000000..750b9334
+ return handlers; + return handlers;
+ } + }
+ +
+ /* + /**
+ * Wraps the Profile Repository so we can intercept all lookups + * Wraps the Profile Repository so we can intercept all lookups
+ * @deprecated will be removed with 1.13
+ */ + */
+ @Deprecated
+ public static GameProfileRepository wrapProfileRepository(final GameProfileRepository orig) { + public static GameProfileRepository wrapProfileRepository(final GameProfileRepository orig) {
+ return (names, agent, callback) -> { + return (names, agent, callback) -> {
+ Set<String> unfoundNames = Sets.newHashSet(); + Set<String> unfoundNames = Sets.newHashSet();
@ -215,6 +236,10 @@ index 00000000..750b9334
+ }; + };
+ } + }
+ +
+ /**
+ * @deprecated will be removed with 1.13
+ */
+ @Deprecated
+ private static class PreProfileLookupCallback implements ProfileLookupCallback { + private static class PreProfileLookupCallback implements ProfileLookupCallback {
+ private final ProfileLookupCallback callback; + private final ProfileLookupCallback callback;
+ +
@ -235,5 +260,5 @@ index 00000000..750b9334
+ } + }
+} +}
-- --
2.13.3.windows.1 2.14.1