diff options
Diffstat (limited to 'patches/api/0350-Add-WardenAngerChangeEvent.patch')
-rw-r--r-- | patches/api/0350-Add-WardenAngerChangeEvent.patch | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/patches/api/0350-Add-WardenAngerChangeEvent.patch b/patches/api/0350-Add-WardenAngerChangeEvent.patch index 4291ccd615..d37a8bcb83 100644 --- a/patches/api/0350-Add-WardenAngerChangeEvent.patch +++ b/patches/api/0350-Add-WardenAngerChangeEvent.patch @@ -8,10 +8,10 @@ another entity. diff --git a/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2ab6c0244e +index 0000000000000000000000000000000000000000..7c06de67121f92f6e1e8890f250157721c78e627 --- /dev/null +++ b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java -@@ -0,0 +1,108 @@ +@@ -0,0 +1,103 @@ +package io.papermc.paper.event.entity; + +import com.google.common.base.Preconditions; @@ -21,14 +21,15 @@ index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2a +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.Range; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a Warden's anger level has changed due to another entity. + * <p> + * If the event is cancelled, the warden's anger level will not change. + */ ++@NullMarked +public class WardenAngerChangeEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -40,7 +41,7 @@ index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2a + private boolean cancelled; + + @ApiStatus.Internal -+ public WardenAngerChangeEvent(@NotNull final Warden warden, @NotNull final Entity target, final int oldAnger, final int newAnger) { ++ public WardenAngerChangeEvent(final Warden warden, final Entity target, final int oldAnger, final int newAnger) { + super(warden); + this.target = target; + this.oldAnger = oldAnger; @@ -52,7 +53,6 @@ index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2a + * + * @return triggering entity + */ -+ @NotNull + public Entity getTarget() { + return this.target; + } @@ -63,8 +63,7 @@ index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2a + * @return old anger level + * @see Warden#getAnger(Entity) + */ -+ @Range(from = 0, to = 150) -+ public int getOldAnger() { ++ public @Range(from = 0, to = 150) int getOldAnger() { + return this.oldAnger; + } + @@ -74,8 +73,7 @@ index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2a + * @return new anger level + * @see Warden#getAnger(Entity) + */ -+ @Range(from = 0, to = 150) -+ public int getNewAnger() { ++ public @Range(from = 0, to = 150) int getNewAnger() { + return this.newAnger; + } + @@ -85,15 +83,14 @@ index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2a + * The anger of a warden is capped at 150. + * + * @param newAnger the new anger level, max 150 -+ * @see Warden#setAnger(Entity, int) + * @throws IllegalArgumentException if newAnger is greater than 150 ++ * @see Warden#setAnger(Entity, int) + */ -+ public void setNewAnger(@Range(from = 0, to = 150) int newAnger) { ++ public void setNewAnger(final @Range(from = 0, to = 150) int newAnger) { + Preconditions.checkArgument(newAnger <= 150, "newAnger must not be greater than 150"); + this.newAnger = newAnger; + } + -+ @NotNull + @Override + public Warden getEntity() { + return (Warden) super.getEntity(); @@ -105,17 +102,15 @@ index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2a + } + + @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; + } |