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
parent fa1f6a5d78
commit 64e918335c
62 changed files with 580 additions and 750 deletions

View File

@@ -13,19 +13,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package com.destroystokyo.paper.event.entity;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.SkeletonHorse;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Event called when a player gets close to a skeleton horse and triggers the lightning trap
+ */
+@NullMarked
+public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
@@ -35,23 +35,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Deprecated
+ @ApiStatus.Internal
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse) {
+ public SkeletonHorseTrapEvent(final SkeletonHorse horse) {
+ this(horse, ImmutableList.of());
+ }
+
+ @ApiStatus.Internal
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse, @NotNull List<HumanEntity> eligibleHumans) {
+ public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) {
+ super(horse);
+ this.eligibleHumans = eligibleHumans;
+ }
+
+ @NotNull
+ @Override
+ public SkeletonHorse getEntity() {
+ return (SkeletonHorse) super.getEntity();
+ }
+
+ @NotNull
+ public List<HumanEntity> getEligibleHumans() {
+ return this.eligibleHumans;
+ }
@@ -62,17 +60,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @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;
+ }