Finish converting all events to jspecify annotations

This commit is contained in:
Jake Potrebic 2024-09-29 16:48:34 -07:00
parent ea00be3aaa
commit ba3c29b92e
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
82 changed files with 977 additions and 1103 deletions

View file

@ -6,30 +6,31 @@ Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..9377ee1c2368ce058397037952d17bc010f66957
index 0000000000000000000000000000000000000000..95a5a59e6bd88345177fca0b12008ddd689cb448
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
@@ -0,0 +1,45 @@
@@ -0,0 +1,43 @@
+package com.destroystokyo.paper.event.server;
+
+import com.destroystokyo.paper.exception.ServerException;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import com.destroystokyo.paper.exception.ServerException;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called whenever an exception is thrown in a recoverable section of the server.
+ */
+@NullMarked
+public class ServerExceptionEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final ServerException exception;
+ private final ServerException exception;
+
+ @ApiStatus.Internal
+ public ServerExceptionEvent(@NotNull ServerException exception) {
+ public ServerExceptionEvent(final ServerException exception) {
+ super(!Bukkit.isPrimaryThread());
+ this.exception = exception;
+ }
@ -39,18 +40,15 @@ index 0000000000000000000000000000000000000000..9377ee1c2368ce058397037952d17bc0
+ *
+ * @return Exception thrown
+ */
+ @NotNull
+ public ServerException getException() {
+ return this.exception;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }