diff options
Diffstat (limited to 'patches/api/0370-Add-PrePlayerAttackEntityEvent.patch')
-rw-r--r-- | patches/api/0370-Add-PrePlayerAttackEntityEvent.patch | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/patches/api/0370-Add-PrePlayerAttackEntityEvent.patch b/patches/api/0370-Add-PrePlayerAttackEntityEvent.patch index ac0ebedde7..1caf6f7696 100644 --- a/patches/api/0370-Add-PrePlayerAttackEntityEvent.patch +++ b/patches/api/0370-Add-PrePlayerAttackEntityEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add PrePlayerAttackEntityEvent diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9cad10e11 +index 0000000000000000000000000000000000000000..a6c5818bcdd8de5f2d0e9bf72d1e3816652e0199 --- /dev/null +++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java -@@ -0,0 +1,93 @@ +@@ -0,0 +1,90 @@ +package io.papermc.paper.event.player; + +import org.bukkit.entity.Entity; @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9 +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when the player tries to attack an entity. @@ -31,18 +31,18 @@ index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9 + * <p> + * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover + */ ++@NullMarked +public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ @NotNull + private final Entity attacked; + private final boolean willAttack; + + private boolean cancelled; + + @ApiStatus.Internal -+ public PrePlayerAttackEntityEvent(@NotNull Player player, @NotNull Entity attacked, boolean willAttack) { ++ public PrePlayerAttackEntityEvent(final Player player, final Entity attacked, final boolean willAttack) { + super(player); + this.attacked = attacked; + this.willAttack = willAttack; @@ -54,7 +54,6 @@ index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9 + * + * @return entity that was attacked + */ -+ @NotNull + public Entity getAttacked() { + return this.attacked; + } @@ -84,7 +83,7 @@ index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9 + * @param cancel {@code true} if you wish to cancel this event + */ + @Override -+ public void setCancelled(boolean cancel) { ++ public void setCancelled(final boolean cancel) { + if (!this.willAttack) { + return; + } @@ -92,13 +91,11 @@ index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9 + this.cancelled = cancel; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } |