Finish converting all events to jspecify annotations

This commit is contained in:
Jake Potrebic
2024-09-29 16:48:34 -07:00
parent fa97c59a4e
commit 29a25df60e
78 changed files with 757 additions and 883 deletions

View File

@@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Is called when a {@link Player} tracks an {@link Entity}.
@@ -28,6 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Adding or removing entities from the world at the point in time this event is called is completely
+ * unsupported and should be avoided.
+ */
+@NullMarked
+public class PlayerTrackEntityEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@@ -36,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerTrackEntityEvent(@NotNull Player player, @NotNull Entity entity) {
+ public PlayerTrackEntityEvent(final Player player, final Entity entity) {
+ super(player);
+ this.entity = entity;
+ }
@@ -46,7 +47,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the entity tracked
+ */
+ @NotNull
+ public Entity getEntity() {
+ return this.entity;
+ }
@@ -57,16 +57,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ public void setCancelled(final boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
@@ -85,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Is called when a {@link Player} untracks an {@link Entity}.
@@ -93,6 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Adding or removing entities from the world at the point in time this event is called is completely
+ * unsupported and should be avoided.
+ */
+@NullMarked
+public class PlayerUntrackEntityEvent extends PlayerEvent {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@@ -100,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private final Entity entity;
+
+ @ApiStatus.Internal
+ public PlayerUntrackEntityEvent(@NotNull Player player, @NotNull Entity entity) {
+ public PlayerUntrackEntityEvent(final Player player, final Entity entity) {
+ super(player);
+ this.entity = entity;
+ }
@@ -110,17 +109,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the entity untracked
+ */
+ @NotNull
+ public Entity getEntity() {
+ return this.entity;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;