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

@@ -12,30 +12,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.event.entity;
+
+import java.util.Collection;
+import org.bukkit.entity.AreaEffectCloud;
+import org.bukkit.entity.DragonFireball;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+import java.util.Collection;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
+ */
+@NullMarked
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final Collection<LivingEntity> targets;
+ @NotNull private final AreaEffectCloud areaEffectCloud;
+ private final Collection<LivingEntity> targets;
+ private final AreaEffectCloud areaEffectCloud;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @NotNull Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
+ public EnderDragonFireballHitEvent(final DragonFireball fireball, final Collection<LivingEntity> targets, final AreaEffectCloud areaEffectCloud) {
+ super(fireball);
+ this.targets = targets;
+ this.areaEffectCloud = areaEffectCloud;
@@ -44,7 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * The fireball involved in this event
+ */
+ @NotNull
+ @Override
+ public DragonFireball getEntity() {
+ return (DragonFireball) super.getEntity();
@@ -55,7 +54,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the targets
+ */
+ @NotNull
+ public Collection<LivingEntity> getTargets() {
+ return this.targets;
+ }
@@ -63,7 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * @return The area effect cloud spawned in this collision
+ */
+ @NotNull
+ public AreaEffectCloud getAreaEffectCloud() {
+ return this.areaEffectCloud;
+ }
@@ -74,17 +71,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;
+ }
@@ -103,20 +98,21 @@ 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.jspecify.annotations.NullMarked;
+
+/**
+ * Fired when an EnderDragon spawns an AreaEffectCloud by shooting flames
+ */
+@NullMarked
+public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final AreaEffectCloud areaEffectCloud;
+ private final AreaEffectCloud areaEffectCloud;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public EnderDragonFlameEvent(@NotNull EnderDragon enderDragon, @NotNull AreaEffectCloud areaEffectCloud) {
+ public EnderDragonFlameEvent(final EnderDragon enderDragon, final AreaEffectCloud areaEffectCloud) {
+ super(enderDragon);
+ this.areaEffectCloud = areaEffectCloud;
+ }
@@ -124,7 +120,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * The enderdragon involved in this event
+ */
+ @NotNull
+ @Override
+ public EnderDragon getEntity() {
+ return (EnderDragon) super.getEntity();
@@ -133,7 +128,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * @return The area effect cloud spawned in this collision
+ */
+ @NotNull
+ public AreaEffectCloud getAreaEffectCloud() {
+ return this.areaEffectCloud;
+ }
@@ -144,16 +138,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ public void setCancelled(final boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
@@ -172,20 +164,21 @@ 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.jspecify.annotations.NullMarked;
+
+/**
+ * Fired when an EnderDragon shoots a fireball
+ */
+@NullMarked
+public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final DragonFireball fireball;
+ private final DragonFireball fireball;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public EnderDragonShootFireballEvent(@NotNull EnderDragon entity, @NotNull DragonFireball fireball) {
+ public EnderDragonShootFireballEvent(final EnderDragon entity, final DragonFireball fireball) {
+ super(entity);
+ this.fireball = fireball;
+ }
@@ -193,7 +186,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * The enderdragon shooting the fireball
+ */
+ @NotNull
+ @Override
+ public EnderDragon getEntity() {
+ return (EnderDragon) super.getEntity();
@@ -202,7 +194,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * @return The fireball being shot
+ */
+ @NotNull
+ public DragonFireball getFireball() {
+ return this.fireball;
+ }
@@ -213,17 +204,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;
+ }