Begin switching to JSpecify annotations (#11448)
* Begin switching to JSpecify annotations * more * fixes
This commit is contained in:
parent
6d7a438fad
commit
f9c7f2a5c1
66 changed files with 750 additions and 920 deletions
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add WaterBottleSplashEvent
|
|||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405389f431a
|
||||
index 0000000000000000000000000000000000000000..1f74ea11c726273c3c2a7fc6f381716e230ef5c9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java
|
||||
@@ -0,0 +1,137 @@
|
||||
@@ -0,0 +1,135 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
|
@ -23,28 +23,29 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+import org.bukkit.entity.ThrownPotion;
|
||||
+import org.bukkit.event.entity.PotionSplashEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a splash water potion "splashes" and affects
|
||||
+ * different entities in different ways.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class WaterBottleSplashEvent extends PotionSplashEvent {
|
||||
+
|
||||
+ private final @NotNull Set<LivingEntity> rehydrate;
|
||||
+ private final @NotNull Set<LivingEntity> extinguish;
|
||||
+ private final Set<LivingEntity> rehydrate;
|
||||
+ private final Set<LivingEntity> extinguish;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WaterBottleSplashEvent(
|
||||
+ final @NotNull ThrownPotion potion,
|
||||
+ final ThrownPotion potion,
|
||||
+ final @Nullable Entity hitEntity,
|
||||
+ final @Nullable Block hitBlock,
|
||||
+ final @Nullable BlockFace hitFace,
|
||||
+ final @NotNull Map<LivingEntity, Double> affectedEntities,
|
||||
+ final @NotNull Set<LivingEntity> rehydrate,
|
||||
+ final @NotNull Set<LivingEntity> extinguish
|
||||
+ final Map<LivingEntity, Double> affectedEntities,
|
||||
+ final Set<LivingEntity> rehydrate,
|
||||
+ final Set<LivingEntity> extinguish
|
||||
+ ) {
|
||||
+ super(potion, hitEntity, hitBlock, hitFace, affectedEntities);
|
||||
+ this.rehydrate = rehydrate;
|
||||
|
@ -61,7 +62,6 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ * @see #doNotDamageAsWaterSensitive(LivingEntity)
|
||||
+ * @see #damageAsWaterSensitive(LivingEntity)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public @Unmodifiable Collection<LivingEntity> getToDamage() {
|
||||
+ return this.affectedEntities.entrySet().stream().filter(entry -> entry.getValue() > 0).map(Map.Entry::getKey).collect(Collectors.toUnmodifiableSet());
|
||||
+ }
|
||||
|
@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ *
|
||||
+ * @param entity entity to remove
|
||||
+ */
|
||||
+ public void doNotDamageAsWaterSensitive(final @NotNull LivingEntity entity) {
|
||||
+ public void doNotDamageAsWaterSensitive(final LivingEntity entity) {
|
||||
+ this.affectedEntities.remove(entity);
|
||||
+ }
|
||||
+
|
||||
|
@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ *
|
||||
+ * @param entity entity to add
|
||||
+ */
|
||||
+ public void damageAsWaterSensitive(final @NotNull LivingEntity entity) {
|
||||
+ public void damageAsWaterSensitive(final LivingEntity entity) {
|
||||
+ this.affectedEntities.put(entity, 1.0);
|
||||
+ }
|
||||
+
|
||||
|
@ -96,7 +96,6 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ *
|
||||
+ * @return the entities
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getToRehydrate() {
|
||||
+ return this.rehydrate;
|
||||
+ }
|
||||
|
@ -107,7 +106,6 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ *
|
||||
+ * @return entities to be extinguished
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getToExtinguish() {
|
||||
+ return this.extinguish;
|
||||
+ }
|
||||
|
@ -118,7 +116,7 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ */
|
||||
+ @Deprecated(since = "1.19.3")
|
||||
+ @Override
|
||||
+ public @NotNull Collection<LivingEntity> getAffectedEntities() {
|
||||
+ public Collection<LivingEntity> getAffectedEntities() {
|
||||
+ return super.getAffectedEntities();
|
||||
+ }
|
||||
+
|
||||
|
@ -130,7 +128,7 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ */
|
||||
+ @Deprecated(since = "1.19.3")
|
||||
+ @Override
|
||||
+ public double getIntensity(final @NotNull LivingEntity entity) {
|
||||
+ public double getIntensity(final LivingEntity entity) {
|
||||
+ return super.getIntensity(entity);
|
||||
+ }
|
||||
+
|
||||
|
@ -143,7 +141,7 @@ index 0000000000000000000000000000000000000000..0c7725980d5a2f3652e53f75329ad405
|
|||
+ */
|
||||
+ @Deprecated(since = "1.19.3")
|
||||
+ @Override
|
||||
+ public void setIntensity(final @NotNull LivingEntity entity, final double intensity) {
|
||||
+ public void setIntensity(final LivingEntity entity, final double intensity) {
|
||||
+ super.setIntensity(entity, intensity);
|
||||
+ }
|
||||
+}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue