switch to JSpecify annotations

This commit is contained in:
granny
2024-10-03 19:33:40 -07:00
parent 212c942316
commit 2eaea6a060
13 changed files with 158 additions and 173 deletions

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] PlayerBookTooLargeEvent
diff --git a/src/main/java/org/purpurmc/purpur/event/player/PlayerBookTooLargeEvent.java b/src/main/java/org/purpurmc/purpur/event/player/PlayerBookTooLargeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c88394336bc9ab0f66a2af24d393f4a176a234d5
index 0000000000000000000000000000000000000000..31cce9f4e398135016114b96254376325a22ba7c
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/player/PlayerBookTooLargeEvent.java
@@ -0,0 +1,65 @@
@@ -17,11 +17,13 @@ index 0000000000000000000000000000000000000000..c88394336bc9ab0f66a2af24d393f4a1
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.ApiStatus;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called when a player tries to bypass book limitations
+ */
+@NullMarked
+public class PlayerBookTooLargeEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final ItemStack book;
@@ -31,7 +33,8 @@ index 0000000000000000000000000000000000000000..c88394336bc9ab0f66a2af24d393f4a1
+ * @param player The player
+ * @param book The book
+ */
+ public PlayerBookTooLargeEvent(@NotNull Player player, @NotNull ItemStack book) {
+ @ApiStatus.Internal
+ public PlayerBookTooLargeEvent(Player player, ItemStack book) {
+ super(player, !Bukkit.isPrimaryThread());
+ this.book = book;
+ }
@@ -41,7 +44,6 @@ index 0000000000000000000000000000000000000000..c88394336bc9ab0f66a2af24d393f4a1
+ *
+ * @return The book
+ */
+ @NotNull
+ public ItemStack getBook() {
+ return book;
+ }
@@ -65,12 +67,10 @@ index 0000000000000000000000000000000000000000..c88394336bc9ab0f66a2af24d393f4a1
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }