aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0061-Profile-Lookup-Events.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/api/0061-Profile-Lookup-Events.patch')
-rw-r--r--patches/api/0061-Profile-Lookup-Events.patch52
1 files changed, 22 insertions, 30 deletions
diff --git a/patches/api/0061-Profile-Lookup-Events.patch b/patches/api/0061-Profile-Lookup-Events.patch
index cc0b655b89..e55a9e329e 100644
--- a/patches/api/0061-Profile-Lookup-Events.patch
+++ b/patches/api/0061-Profile-Lookup-Events.patch
@@ -8,19 +8,18 @@ profiles that had to be looked up.
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 0000000000000000000000000000000000000000..2ad2782aafe76f8b10565c0f0419d6b9c665b267
+index 0000000000000000000000000000000000000000..9e8ae0ab13cac9a260c9959eb6bf5b93a3c15018
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/LookupProfileEvent.java
-@@ -0,0 +1,48 @@
+@@ -0,0 +1,45 @@
+package com.destroystokyo.paper.event.profile;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
-+
+import org.jetbrains.annotations.ApiStatus;
-+import org.jetbrains.annotations.NotNull;
++import org.jspecify.annotations.NullMarked;
+
+/**
+ * Allows a plugin to be notified anytime AFTER a Profile has been looked up from the Mojang API
@@ -29,14 +28,15 @@ index 0000000000000000000000000000000000000000..2ad2782aafe76f8b10565c0f0419d6b9
+ * No guarantees are made about thread execution context for this event. If you need to know, check
+ * {@link Event#isAsynchronous()}
+ */
++@NullMarked
+public class LookupProfileEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
-+ @NotNull private final PlayerProfile profile;
++ private final PlayerProfile profile;
+
+ @ApiStatus.Internal
-+ public LookupProfileEvent(@NotNull PlayerProfile profile) {
++ public LookupProfileEvent(final PlayerProfile profile) {
+ super(!Bukkit.isPrimaryThread());
+ this.profile = profile;
+ }
@@ -44,41 +44,37 @@ index 0000000000000000000000000000000000000000..2ad2782aafe76f8b10565c0f0419d6b9
+ /**
+ * @return The profile that was recently looked up. This profile can be mutated
+ */
-+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return this.profile;
+ }
+
-+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
-+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}
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 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533dfa474356
+index 0000000000000000000000000000000000000000..07416cc9e2b8156be2cc92d6d974b881b427fd99
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
-@@ -0,0 +1,112 @@
+@@ -0,0 +1,107 @@
+package com.destroystokyo.paper.event.profile;
+
+import com.destroystokyo.paper.profile.ProfileProperty;
-+import org.bukkit.Bukkit;
-+import org.bukkit.event.Event;
-+import org.bukkit.event.HandlerList;
-+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
++import org.bukkit.Bukkit;
++import org.bukkit.event.Event;
++import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.ApiStatus;
-+import org.jetbrains.annotations.NotNull;
-+import org.jetbrains.annotations.Nullable;
++import org.jspecify.annotations.NullMarked;
++import org.jspecify.annotations.Nullable;
+
+/**
+ * Allows a plugin to intercept a Profile Lookup for a Profile by name
@@ -90,17 +86,18 @@ index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533d
+ * No guarantees are made about thread execution context for this event. If you need to know, check
+ * {@link Event#isAsynchronous()}
+ */
++@NullMarked
+public class PreLookupProfileEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
-+ @NotNull private final String name;
++ private final String name;
+
-+ private UUID uuid;
-+ @NotNull private Set<ProfileProperty> properties = new HashSet<>();
++ private @Nullable UUID uuid;
++ private Set<ProfileProperty> properties = new HashSet<>();
+
+ @ApiStatus.Internal
-+ public PreLookupProfileEvent(@NotNull String name) {
++ public PreLookupProfileEvent(final String name) {
+ super(!Bukkit.isPrimaryThread());
+ this.name = name;
+ }
@@ -108,7 +105,6 @@ index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533d
+ /**
+ * @return Name of the profile
+ */
-+ @NotNull
+ public String getName() {
+ return this.name;
+ }
@@ -120,8 +116,7 @@ index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533d
+ *
+ * @return The UUID of the profile if it has already been provided by a plugin
+ */
-+ @Nullable
-+ public UUID getUUID() {
++ public @Nullable UUID getUUID() {
+ return this.uuid;
+ }
+
@@ -132,7 +127,7 @@ index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533d
+ *
+ * @param uuid the UUID to set for the profile or {@code null} to reset
+ */
-+ public void setUUID(@Nullable UUID uuid) {
++ public void setUUID(final @Nullable UUID uuid) {
+ this.uuid = uuid;
+ }
+
@@ -140,7 +135,6 @@ index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533d
+ * @return The currently pending pre-populated properties.
+ * Any property in this Set will be automatically prefilled on this Profile
+ */
-+ @NotNull
+ public Set<ProfileProperty> getProfileProperties() {
+ return this.properties;
+ }
@@ -151,7 +145,7 @@ index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533d
+ *
+ * @param properties The properties to add
+ */
-+ public void setProfileProperties(@NotNull Set<ProfileProperty> properties) {
++ public void setProfileProperties(final Set<ProfileProperty> properties) {
+ this.properties = new HashSet<>();
+ this.properties.addAll(properties);
+ }
@@ -162,17 +156,15 @@ index 0000000000000000000000000000000000000000..3f73ec52f9b581001bef3a19a5f1533d
+ *
+ * @param properties The properties to add
+ */
-+ public void addProfileProperties(@NotNull Set<ProfileProperty> properties) {
++ public void addProfileProperties(final Set<ProfileProperty> properties) {
+ this.properties.addAll(properties);
+ }
+
-+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
-+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }