Begin switching to JSpecify annotations (#11448)

* Begin switching to JSpecify annotations

* more

* fixes
This commit is contained in:
Jake Potrebic 2024-09-29 12:52:13 -07:00 committed by GitHub
parent 6d7a438fad
commit f9c7f2a5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 750 additions and 920 deletions

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add whitelist events
diff --git a/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73ccc8779f
index 0000000000000000000000000000000000000000..ff8c2c74fc68b1dd564e07c938b28b5950871533
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java
@@ -0,0 +1,87 @@
@@ -0,0 +1,83 @@
+package io.papermc.paper.event.server;
+
+import com.destroystokyo.paper.profile.PlayerProfile;
@ -19,22 +19,23 @@ index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73
+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;
+
+/**
+ * This event gets called when the whitelist status of a player is changed
+ */
+@NullMarked
+public class WhitelistStateUpdateEvent extends Event implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final PlayerProfile playerProfile;
+ @NotNull private final WhitelistStatus status;
+ private final PlayerProfile playerProfile;
+ private final WhitelistStatus status;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public WhitelistStateUpdateEvent(@NotNull PlayerProfile playerProfile, @NotNull WhitelistStatus status) {
+ public WhitelistStateUpdateEvent(final PlayerProfile playerProfile, final WhitelistStatus status) {
+ this.playerProfile = playerProfile;
+ this.status = status;
+ }
@ -44,7 +45,6 @@ index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73
+ *
+ * @return the player whose status is being changed
+ */
+ @NotNull
+ public OfflinePlayer getPlayer() {
+ return Bukkit.getOfflinePlayer(this.playerProfile.getId());
+ }
@ -54,7 +54,6 @@ index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73
+ *
+ * @return the player profile whose status is being changed
+ */
+ @NotNull
+ public PlayerProfile getPlayerProfile() {
+ return this.playerProfile;
+ }
@ -64,7 +63,6 @@ index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73
+ *
+ * @return the whitelist status
+ */
+ @NotNull
+ public WhitelistStatus getStatus() {
+ return this.status;
+ }
@ -75,17 +73,15 @@ index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ public void setCancelled(final boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }