[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002 2024-02-01 10:15:57 +01:00 committed by GitHub
parent b3c81089ae
commit 294347bee2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
295 changed files with 3245 additions and 3088 deletions

View file

@ -12,10 +12,10 @@ This is useful for implementing a ProfileCache for Player Skulls
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018de959040a
index 0000000000000000000000000000000000000000..c97ded9f9ef1c550cca7d0a3a3b09a85e5999cdf
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/FillProfileEvent.java
@@ -0,0 +1,75 @@
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -47,14 +47,19 @@ index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018d
+import org.bukkit.event.HandlerList;
+
+import java.util.Set;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired once a profiles additional properties (such as textures) has been filled
+ */
+public class FillProfileEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final PlayerProfile profile;
+
+ @ApiStatus.Internal
+ public FillProfileEvent(@NotNull PlayerProfile profile) {
+ super(!org.bukkit.Bukkit.isPrimaryThread());
+ this.profile = profile;
@ -65,7 +70,7 @@ index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018d
+ */
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return profile;
+ return this.profile;
+ }
+
+ /**
@ -76,27 +81,26 @@ index 0000000000000000000000000000000000000000..71f36e9cae209ec6861835a5e76e018d
+ */
+ @NotNull
+ public Set<ProfileProperty> getProperties() {
+ return profile.getProperties();
+ return this.profile.getProperties();
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb8927802726399c
index 0000000000000000000000000000000000000000..e2a47c4af2c368a361e4a370a01111abe8e48062
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreFillProfileEvent.java
@@ -0,0 +1,77 @@
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -128,16 +132,21 @@ index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb892780
+import org.bukkit.event.HandlerList;
+
+import java.util.Collection;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Fired when the server is requesting to fill in properties of an incomplete profile, such as textures.
+ *
+ * Allows plugins to pre populate cached properties and avoid a call to the Mojang API
+ * <p>
+ * Allows plugins to pre-populate cached properties and avoid a call to the Mojang API
+ */
+public class PreFillProfileEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final PlayerProfile profile;
+
+ @ApiStatus.Internal
+ public PreFillProfileEvent(@NotNull PlayerProfile profile) {
+ super(!org.bukkit.Bukkit.isPrimaryThread());
+ this.profile = profile;
@ -148,7 +157,7 @@ index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb892780
+ */
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return profile;
+ return this.profile;
+ }
+
+ /**
@ -159,18 +168,17 @@ index 0000000000000000000000000000000000000000..021bc86310a06f84b39459e0eb892780
+ * @param properties The properties to set/append
+ */
+ public void setProperties(@NotNull Collection<ProfileProperty> properties) {
+ profile.setProperties(properties);
+ this.profile.setProperties(properties);
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}