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

@ -53,24 +53,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jspecify.annotations.NullMarked;
+import org.jspecify.annotations.Nullable;
+
+/**
+ * Called when an entity is dyed. Currently, this is called for {@link Sheep}
+ * being dyed, and {@link Wolf}/{@link Cat} collars being dyed.
+ */
+@NullMarked
+public class EntityDyeEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final Player player;
+ private final @Nullable Player player;
+ private DyeColor dyeColor;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public EntityDyeEvent(@NotNull Entity entity, @NotNull DyeColor dyeColor, @Nullable Player player) {
+ public EntityDyeEvent(final Entity entity, final DyeColor dyeColor, final @Nullable Player player) {
+ super(entity);
+ this.dyeColor = dyeColor;
+ this.player = player;
@ -81,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the DyeColor the entity is being dyed
+ */
+ public @NotNull DyeColor getColor() {
+ public DyeColor getColor() {
+ return this.dyeColor;
+ }
+
@ -90,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param dyeColor the DyeColor the entity will be dyed
+ */
+ public void setColor(@NotNull DyeColor dyeColor) {
+ public void setColor(final DyeColor dyeColor) {
+ this.dyeColor = dyeColor;
+ }
+
@ -109,16 +110,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ public void setCancelled(final boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ public static @NotNull HandlerList getHandlerList() {
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}