Swap some nullable annotations (#9696)

This commit is contained in:
Lulu13022002
2023-09-14 12:44:12 +02:00
parent 11f2c20c6a
commit abbdae4f53
9 changed files with 171 additions and 57 deletions

View File

@@ -20,17 +20,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.entity.EntityEvent;
+
+import java.util.Collection;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
+ */
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
+ @Nullable private final Collection<LivingEntity> targets;
+ @NotNull private final AreaEffectCloud areaEffectCloud;
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @Nullable Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
+ @NotNull private final Collection<LivingEntity> targets;
+ @NotNull private final AreaEffectCloud areaEffectCloud;
+ private boolean cancelled = false;
+
+ @ApiStatus.Internal
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @NotNull Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
+ super(fireball);
+ this.targets = targets;
+ this.areaEffectCloud = areaEffectCloud;
@@ -48,11 +52,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * The living entities hit by fireball
+ *
+ * May be null if no entities were hit
+ *
+ * @return the targets
+ */
+ @Nullable
+ @NotNull
+ public Collection<LivingEntity> getTargets() {
+ return targets;
+ }
@@ -65,20 +67,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return areaEffectCloud;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
@@ -88,6 +76,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EnderDragonFlameEvent.java
new file mode 100644