From 64e918335ca1f46cf2cf49205b26b2476aa8329c Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 29 Sep 2024 12:52:13 -0700 Subject: [PATCH] Begin switching to JSpecify annotations (#11448) * Begin switching to JSpecify annotations * more * fixes --- patches/api/Add-BeaconEffectEvent.patch | 13 +- patches/api/Add-BlockBreakBlockEvent.patch | 14 +- .../Add-BlockBreakProgressUpdateEvent.patch | 17 ++- .../api/Add-BlockFailedDispenseEvent.patch | 12 +- patches/api/Add-BlockLockCheckEvent.patch | 40 ++--- patches/api/Add-BlockPreDispenseEvent.patch | 10 +- ...ItemEvent-and-EntityCompostItemEvent.patch | 19 ++- .../Add-ElderGuardianAppearanceEvent.patch | 11 +- ...eEvent-and-CollarColorable-interface.patch | 19 +-- patches/api/Add-EntityFertilizeEggEvent.patch | 28 ++-- patches/api/Add-EntityInsideBlockEvent.patch | 10 +- patches/api/Add-EntityLoadCrossbowEvent.patch | 14 +- patches/api/Add-EntityPortalReadyEvent.patch | 17 ++- .../Add-EntityTeleportEndGatewayEvent.patch | 8 +- patches/api/Add-EntityZapEvent.patch | 16 +- patches/api/Add-GS4-Query-event.patch | 143 +++++++----------- patches/api/Add-More-Creeper-API.patch | 12 +- patches/api/Add-PhantomPreSpawnEvent.patch | 8 +- .../api/Add-PlayerConnectionCloseEvent.patch | 21 +-- patches/api/Add-PlayerShearBlockEvent.patch | 18 +-- ...reResultEvent-PrepareGrindstoneEvent.patch | 12 +- .../api/Add-PufferFishStateChangeEvent.patch | 10 +- patches/api/Add-ShulkerDuplicateEvent.patch | 11 +- .../api/Add-TameableDeathMessageEvent.patch | 13 +- patches/api/Add-TargetHitEvent-API.patch | 9 +- patches/api/Add-ThrownEggHatchEvent.patch | 19 +-- patches/api/Add-WardenAngerChangeEvent.patch | 21 +-- patches/api/Add-WaterBottleSplashEvent.patch | 30 ++-- patches/api/Add-WhitelistToggleEvent.patch | 7 +- patches/api/Add-entity-knockback-events.patch | 35 +++-- ...ent-to-allow-plugins-to-handle-clien.patch | 58 +++---- patches/api/Add-whitelist-events.patch | 16 +- patches/api/Added-EntityDamageItemEvent.patch | 12 +- patches/api/Added-EntityToggleSitEvent.patch | 9 +- .../Added-ServerResourcesReloadedEvent.patch | 8 +- patches/api/AnvilDamageEvent.patch | 28 ++-- patches/api/AsyncTabCompleteEvent.patch | 61 ++++---- patches/api/BlockDestroyEvent.patch | 20 ++- patches/api/Brigadier-based-command-API.patch | 32 ++-- patches/api/Build-system-changes.patch | 1 + patches/api/EnderDragon-Events.patch | 45 +++--- patches/api/EndermanAttackPlayerEvent.patch | 13 +- patches/api/EndermanEscapeEvent.patch | 15 +- ...Entity-AddTo-RemoveFrom-World-Events.patch | 20 +-- patches/api/Entity-Jump-API.patch | 10 +- patches/api/EntityMoveEvent.patch | 26 ++-- patches/api/EntityPathfindEvent.patch | 22 ++- .../ExperienceOrb-merging-stacking-API.patch | 15 +- ...eacon-activation-deactivation-events.patch | 20 +-- .../PlayerNaturallySpawnCreaturesEvent.patch | 15 +- patches/api/PreCreatureSpawnEvent.patch | 20 +-- patches/api/PreSpawnerSpawnEvent.patch | 8 +- patches/api/Profile-Lookup-Events.patch | 44 +++--- patches/api/Server-Tick-Events.patch | 14 +- patches/api/SkeletonHorse-Additions.patch | 16 +- patches/api/Slime-Pathfinder-Events.patch | 35 ++--- patches/api/Test-changes.patch | 25 +++ patches/api/Turtle-API.patch | 37 ++--- patches/api/WitchConsumePotionEvent.patch | 19 +-- patches/api/WitchReadyPotionEvent.patch | 19 +-- patches/api/WitchThrowPotionEvent.patch | 22 ++- patches/api/add-DragonEggFormEvent.patch | 8 +- 62 files changed, 580 insertions(+), 750 deletions(-) diff --git a/patches/api/Add-BeaconEffectEvent.patch b/patches/api/Add-BeaconEffectEvent.patch index 7d4b19c8b8..93ca07efb8 100644 --- a/patches/api/Add-BeaconEffectEvent.patch +++ b/patches/api/Add-BeaconEffectEvent.patch @@ -19,11 +19,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.block.BlockEvent; +import org.bukkit.potion.PotionEffect; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a beacon effect is being applied to a player. + */ ++@NullMarked +public class BeaconEffectEvent extends BlockEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -35,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) { ++ public BeaconEffectEvent(final Block block, final PotionEffect effect, final Player player, final boolean primary) { + super(block); + this.effect = effect; + this.player = player; @@ -47,7 +48,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return Potion effect + */ -+ @NotNull + public PotionEffect getEffect() { + return this.effect; + } @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param effect Potion effect + */ -+ public void setEffect(@NotNull PotionEffect effect) { ++ public void setEffect(final PotionEffect effect) { + this.effect = effect; + } + @@ -66,7 +66,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return Affected player + */ -+ @NotNull + public Player getPlayer() { + return this.player; + } @@ -86,17 +85,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; + } diff --git a/patches/api/Add-BlockBreakBlockEvent.patch b/patches/api/Add-BlockBreakBlockEvent.patch index 981ddd8f87..20c95a9c64 100644 --- a/patches/api/Add-BlockBreakBlockEvent.patch +++ b/patches/api/Add-BlockBreakBlockEvent.patch @@ -12,20 +12,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package io.papermc.paper.event.block; + ++import java.util.List; +import org.bukkit.block.Block; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockExpEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.List; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a block forces another block to break and drop items. + *

+ * Currently called for piston's and liquid flows. + */ ++@NullMarked +public class BlockBreakBlockEvent extends BlockExpEvent { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -34,18 +34,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final List drops; + + @ApiStatus.Internal -+ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List drops) { ++ public BlockBreakBlockEvent(final Block block, final Block source, final List drops) { + super(block, 0); + this.source = source; + this.drops = drops; + } + + /** -+ * Gets the drops of this event ++ * Gets a mutable list of drops for this event + * + * @return the drops + */ -+ @NotNull + public List getDrops() { + return this.drops; + } @@ -55,18 +54,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the source + */ -+ @NotNull + public Block getSource() { + return this.source; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } diff --git a/patches/api/Add-BlockBreakProgressUpdateEvent.patch b/patches/api/Add-BlockBreakProgressUpdateEvent.patch index c8267ac41a..93a8f66af6 100644 --- a/patches/api/Add-BlockBreakProgressUpdateEvent.patch +++ b/patches/api/Add-BlockBreakProgressUpdateEvent.patch @@ -17,20 +17,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Range; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when the progress of a block break is updated. + */ ++@NullMarked +public class BlockBreakProgressUpdateEvent extends BlockEvent { ++ + private static final HandlerList HANDLER_LIST = new HandlerList(); + + private final float progress; + private final Entity entity; + + @ApiStatus.Internal -+ public BlockBreakProgressUpdateEvent(@NotNull final Block block, final float progress, @NotNull final Entity entity) { ++ public BlockBreakProgressUpdateEvent(final Block block, final float progress, final Entity entity) { + super(block); + this.progress = progress; + this.entity = entity; @@ -45,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return The progress of the block break + */ + public float getProgress() { -+ return progress; ++ return this.progress; + } + + /** @@ -53,16 +54,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The entity breaking the block + */ -+ @NotNull + public Entity getEntity() { -+ return entity; ++ return this.entity; + } + + @Override -+ public @NotNull HandlerList getHandlers() { ++ public HandlerList getHandlers() { + return HANDLER_LIST; + } -+ public static @NotNull HandlerList getHandlerList() { ++ ++ public static HandlerList getHandlerList() { + return HANDLER_LIST; + } +} diff --git a/patches/api/Add-BlockFailedDispenseEvent.patch b/patches/api/Add-BlockFailedDispenseEvent.patch index bf32471416..6d9bfcf264 100644 --- a/patches/api/Add-BlockFailedDispenseEvent.patch +++ b/patches/api/Add-BlockFailedDispenseEvent.patch @@ -15,12 +15,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.block.Block; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockEvent; ++import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a block tries to dispense an item, but its inventory is empty. + */ ++@NullMarked +public class BlockFailedDispenseEvent extends BlockEvent { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -28,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean shouldPlayEffect = true; + + @ApiStatus.Internal -+ public BlockFailedDispenseEvent(@NotNull Block theBlock) { ++ public BlockFailedDispenseEvent(final Block theBlock) { + super(theBlock); + } + @@ -44,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param playEffect if the effect should be played + */ -+ public void shouldPlayEffect(boolean playEffect) { ++ public void shouldPlayEffect(final boolean playEffect) { + this.shouldPlayEffect = playEffect; + } + @@ -58,11 +60,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public @NotNull HandlerList getHandlers() { ++ public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ public static @NotNull HandlerList getHandlerList() { ++ public static HandlerList getHandlerList() { + return HANDLER_LIST; + } +} diff --git a/patches/api/Add-BlockLockCheckEvent.patch b/patches/api/Add-BlockLockCheckEvent.patch index 8cd0f1ce36..5c928a4ab7 100644 --- a/patches/api/Add-BlockLockCheckEvent.patch +++ b/patches/api/Add-BlockLockCheckEvent.patch @@ -31,6 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import com.google.common.base.Preconditions; +import io.papermc.paper.block.LockableTileState; ++import java.util.Objects; +import net.kyori.adventure.sound.Sound; +import net.kyori.adventure.text.Component; +import org.bukkit.block.Block; @@ -40,28 +41,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.block.BlockEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+import java.util.Objects; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; + +/** + * Called when the server tries to check the lock on a lockable block entity. + *
+ * See {@link #setResult(Result)} to change behavior + */ ++@NullMarked +public class BlockLockCheckEvent extends BlockEvent { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + + private final Player player; -+ private Component lockedMessage; -+ private Sound lockedSound; -+ private ItemStack itemStack; ++ private @Nullable Component lockedMessage; ++ private @Nullable Sound lockedSound; ++ private @Nullable ItemStack itemStack; + private Result result = Result.DEFAULT; + + @ApiStatus.Internal -+ public BlockLockCheckEvent(final @NotNull Block block, final @NotNull Player player, final @NotNull Component lockedMessage, final @NotNull Sound lockedSound) { ++ public BlockLockCheckEvent(final Block block, final Player player, final Component lockedMessage, final Sound lockedSound) { + super(block); + this.player = player; + this.lockedMessage = lockedMessage; @@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the snapshot block state. + */ -+ public @NotNull LockableTileState getBlockState() { ++ public LockableTileState getBlockState() { + final BlockState blockState = this.getBlock().getState(); + Preconditions.checkState(blockState instanceof LockableTileState, "Block state of lock-checked block is no longer a lockable tile state!"); + return (LockableTileState) blockState; @@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the player + */ -+ public @NotNull Player getPlayer() { ++ public Player getPlayer() { + return this.player; + } + @@ -98,7 +98,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return the item being used as the key item + * @see #isUsingCustomKeyItemStack() + */ -+ public @NotNull ItemStack getKeyItem() { ++ public ItemStack getKeyItem() { + return Objects.requireNonNullElseGet(this.itemStack, this.player.getInventory()::getItemInMainHand); + } + @@ -108,7 +108,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param stack the stack to use as a key + * @see #resetKeyItem() to clear a custom key item + */ -+ public void setKeyItem(@NotNull ItemStack stack) { ++ public void setKeyItem(final ItemStack stack) { + Preconditions.checkArgument(stack != null, "stack cannot be null"); + this.itemStack = stack; + } @@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return the result + * @see #setResult(Result) + */ -+ public @NotNull Result getResult() { ++ public Result getResult() { + return this.result; + } + @@ -148,7 +148,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param result the result of this event + */ -+ public void setResult(@NotNull Result result) { ++ public void setResult(final Result result) { + this.result = result; + } + @@ -157,9 +157,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * the locked message and locked sound. + * + * @param lockedMessage the message to show if locked (or {@code null} for none) -+ * @param lockedSound the sound to play if locked (or {@code null} for none) ++ * @param lockedSound the sound to play if locked (or {@code null} for none) + */ -+ public void denyWithMessageAndSound(@Nullable Component lockedMessage, @Nullable Sound lockedSound) { ++ public void denyWithMessageAndSound(final @Nullable Component lockedMessage, final @Nullable Sound lockedSound) { + this.result = Result.DENY; + this.lockedMessage = lockedMessage; + this.lockedSound = lockedSound; @@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param lockedMessage the locked message (or {@code null} for none) + */ -+ public void setLockedMessage(@Nullable Component lockedMessage) { ++ public void setLockedMessage(final @Nullable Component lockedMessage) { + this.lockedMessage = lockedMessage; + } + @@ -201,16 +201,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param lockedSound the locked sound (or {@code null} for none) + */ -+ public void setLockedSound(@Nullable Sound lockedSound) { ++ public void setLockedSound(final @Nullable Sound lockedSound) { + this.lockedSound = lockedSound; + } + + @Override -+ public @NotNull HandlerList getHandlers() { ++ public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ public static @NotNull HandlerList getHandlerList() { ++ public static HandlerList getHandlerList() { + return HANDLER_LIST; + } +} diff --git a/patches/api/Add-BlockPreDispenseEvent.patch b/patches/api/Add-BlockPreDispenseEvent.patch index 9991c2c31e..8f9677c2fe 100644 --- a/patches/api/Add-BlockPreDispenseEvent.patch +++ b/patches/api/Add-BlockPreDispenseEvent.patch @@ -18,8 +18,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.block.BlockEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + ++@NullMarked +public class BlockPreDispenseEvent extends BlockEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -30,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public BlockPreDispenseEvent(@NotNull Block block, @NotNull ItemStack itemStack, int slot) { ++ public BlockPreDispenseEvent(final Block block, final ItemStack itemStack, final int slot) { + super(block); + this.itemStack = itemStack; + this.slot = slot; @@ -41,7 +42,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The item to be dispensed + */ -+ @NotNull + public ItemStack getItemStack() { + return this.itemStack; + } @@ -61,16 +61,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; + } diff --git a/patches/api/Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/api/Add-CompostItemEvent-and-EntityCompostItemEvent.patch index 0a745c8a19..912fbf2570 100644 --- a/patches/api/Add-CompostItemEvent-and-EntityCompostItemEvent.patch +++ b/patches/api/Add-CompostItemEvent-and-EntityCompostItemEvent.patch @@ -18,12 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.inventory.InventoryMoveItemEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when an item is about to be composted by a hopper. + * To prevent hoppers from moving items into composters, cancel the {@link InventoryMoveItemEvent}. + */ ++@NullMarked +public class CompostItemEvent extends BlockEvent { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -32,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean willRaiseLevel; + + @ApiStatus.Internal -+ public CompostItemEvent(@NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) { ++ public CompostItemEvent(final Block composter, final ItemStack item, final boolean willRaiseLevel) { + super(composter); + this.item = item; + this.willRaiseLevel = willRaiseLevel; @@ -43,7 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the item + */ -+ @NotNull + public ItemStack getItem() { + return this.item; + } @@ -62,16 +62,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param willRaiseLevel {@code true} if the composter should rise a level + */ -+ public void setWillRaiseLevel(boolean willRaiseLevel) { ++ public void setWillRaiseLevel(final boolean willRaiseLevel) { + this.willRaiseLevel = willRaiseLevel; + } + + @Override -+ public @NotNull HandlerList getHandlers() { ++ public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } @@ -91,18 +90,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.Cancellable; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when an item is about to be composted by an entity. + */ ++@NullMarked +public class EntityCompostItemEvent extends CompostItemEvent implements Cancellable { + + private final Entity entity; + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityCompostItemEvent(@NotNull Entity entity, @NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) { ++ public EntityCompostItemEvent(final Entity entity, final Block composter, final ItemStack item, final boolean willRaiseLevel) { + super(composter, item, willRaiseLevel); + this.entity = entity; + } @@ -112,7 +112,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the entity that composted an item. + */ -+ @NotNull + public Entity getEntity() { + return this.entity; + } @@ -123,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public void setCancelled(boolean cancel) { ++ public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + diff --git a/patches/api/Add-ElderGuardianAppearanceEvent.patch b/patches/api/Add-ElderGuardianAppearanceEvent.patch index 32b03d0ae1..e6c5445e28 100644 --- a/patches/api/Add-ElderGuardianAppearanceEvent.patch +++ b/patches/api/Add-ElderGuardianAppearanceEvent.patch @@ -18,11 +18,12 @@ 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; + +/** + * Is called when an {@link ElderGuardian} appears in front of a {@link Player}. + */ ++@NullMarked +public class ElderGuardianAppearanceEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -31,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public ElderGuardianAppearanceEvent(@NotNull ElderGuardian guardian, @NotNull Player affectedPlayer) { ++ public ElderGuardianAppearanceEvent(final ElderGuardian guardian, final Player affectedPlayer) { + super(guardian); + this.affectedPlayer = affectedPlayer; + } @@ -41,7 +42,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return Player affected by the appearance + */ -+ @NotNull + public Player getAffectedPlayer() { + return this.affectedPlayer; + } @@ -51,7 +51,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The elder guardian + */ -+ @NotNull + public ElderGuardian getEntity() { + return (ElderGuardian) super.getEntity(); + } @@ -62,17 +61,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; + } diff --git a/patches/api/Add-EntityDyeEvent-and-CollarColorable-interface.patch b/patches/api/Add-EntityDyeEvent-and-CollarColorable-interface.patch index a67b22d742..82546010c5 100644 --- a/patches/api/Add-EntityDyeEvent-and-CollarColorable-interface.patch +++ b/patches/api/Add-EntityDyeEvent-and-CollarColorable-interface.patch @@ -53,24 +53,25 @@ 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.jetbrains.annotations.Nullable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; + +/** + * Called when an entity is dyed. Currently, this is called for {@link Sheep} + * being dyed, and {@link Wolf}/{@link Cat} collars being dyed. + */ ++@NullMarked +public class EntityDyeEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ private final Player player; ++ private final @Nullable Player player; + private DyeColor dyeColor; + + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityDyeEvent(@NotNull Entity entity, @NotNull DyeColor dyeColor, @Nullable Player player) { ++ public EntityDyeEvent(final Entity entity, final DyeColor dyeColor, final @Nullable Player player) { + super(entity); + this.dyeColor = dyeColor; + this.player = player; @@ -81,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the DyeColor the entity is being dyed + */ -+ public @NotNull DyeColor getColor() { ++ public DyeColor getColor() { + return this.dyeColor; + } + @@ -90,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param dyeColor the DyeColor the entity will be dyed + */ -+ public void setColor(@NotNull DyeColor dyeColor) { ++ public void setColor(final DyeColor dyeColor) { + this.dyeColor = dyeColor; + } + @@ -109,16 +110,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public void setCancelled(boolean cancel) { ++ public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + + @Override -+ public @NotNull HandlerList getHandlers() { ++ public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ public static @NotNull HandlerList getHandlerList() { ++ public static HandlerList getHandlerList() { + return HANDLER_LIST; + } +} diff --git a/patches/api/Add-EntityFertilizeEggEvent.patch b/patches/api/Add-EntityFertilizeEggEvent.patch index 18c8a8b34e..6b1faa8b1a 100644 --- a/patches/api/Add-EntityFertilizeEggEvent.patch +++ b/patches/api/Add-EntityFertilizeEggEvent.patch @@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.entity.EntityEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; + +/** + * Called when two entities mate and the mating process results in a fertilization. @@ -35,23 +35,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + *

  • Sniffers producing the {@link Material#SNIFFER_EGG} item, which needs to be placed before it can begin to hatch.
  • + *
  • A turtle being marked with "HasEgg" and laying a {@link Material#TURTLE_EGG} later.
  • + * -+ * ++ *

    + * The event hence only exposes the two parent entities in the fertilization process and cannot provide the child entity, as it will only exist at a later point in time. + */ ++@NullMarked +public class EntityFertilizeEggEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + + private final LivingEntity mother; + private final LivingEntity father; -+ private final Player breeder; -+ private final ItemStack bredWith; ++ private final @Nullable Player breeder; ++ private final @Nullable ItemStack bredWith; + private int experience; + + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityFertilizeEggEvent(@NotNull LivingEntity mother, @NotNull LivingEntity father, @Nullable Player breeder, @Nullable ItemStack bredWith, int experience) { ++ public EntityFertilizeEggEvent(final LivingEntity mother, final LivingEntity father, final @Nullable Player breeder, final @Nullable ItemStack bredWith, final int experience) { + super(mother); + this.mother = mother; + this.father = father; @@ -60,7 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.experience = experience; + } + -+ @NotNull + @Override + public LivingEntity getEntity() { + return (LivingEntity) super.getEntity(); @@ -72,7 +72,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The "mother" entity. + */ -+ @NotNull + public LivingEntity getMother() { + return this.mother; + } @@ -83,7 +82,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the other parent + */ -+ @NotNull + public LivingEntity getFather() { + return this.father; + } @@ -94,8 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The Entity who initiated fertilization. + */ -+ @Nullable -+ public Player getBreeder() { ++ public @Nullable Player getBreeder() { + return this.breeder; + } + @@ -104,8 +101,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return ItemStack used to initiate fertilization. + */ -+ @Nullable -+ public ItemStack getBredWith() { ++ public @Nullable ItemStack getBredWith() { + return this.bredWith; + } + @@ -124,7 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param experience experience amount + */ -+ public void setExperience(int experience) { ++ public void setExperience(final int experience) { + this.experience = experience; + } + @@ -134,17 +130,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; + } diff --git a/patches/api/Add-EntityInsideBlockEvent.patch b/patches/api/Add-EntityInsideBlockEvent.patch index fc1b1084f7..3095d0b233 100644 --- a/patches/api/Add-EntityInsideBlockEvent.patch +++ b/patches/api/Add-EntityInsideBlockEvent.patch @@ -18,7 +18,7 @@ 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; + +/** + * Called when an entity enters the hitbox of a block. @@ -53,6 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + *

  • Wither rose
  • + * + */ ++@NullMarked +public class EntityInsideBlockEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -61,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityInsideBlockEvent(@NotNull Entity entity, @NotNull Block block) { ++ public EntityInsideBlockEvent(final Entity entity, final Block block) { + super(entity); + this.block = block; + } @@ -71,7 +72,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the block + */ -+ @NotNull + public Block getBlock() { + return this.block; + } @@ -82,17 +82,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; + } diff --git a/patches/api/Add-EntityLoadCrossbowEvent.patch b/patches/api/Add-EntityLoadCrossbowEvent.patch index 5c191dd0c2..6f7e607830 100644 --- a/patches/api/Add-EntityLoadCrossbowEvent.patch +++ b/patches/api/Add-EntityLoadCrossbowEvent.patch @@ -19,11 +19,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a LivingEntity loads a crossbow with a projectile. + */ ++@NullMarked +public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -35,13 +36,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @NotNull ItemStack crossbow, @NotNull EquipmentSlot hand) { ++ public EntityLoadCrossbowEvent(final LivingEntity entity, final ItemStack crossbow, final EquipmentSlot hand) { + super(entity); + this.crossbow = crossbow; + this.hand = hand; + } + -+ @NotNull + @Override + public LivingEntity getEntity() { + return (LivingEntity) super.getEntity(); @@ -52,7 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the crossbow involved in this event + */ -+ @NotNull + public ItemStack getCrossbow() { + return this.crossbow; + } @@ -62,7 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the hand + */ -+ @NotNull + public EquipmentSlot getHand() { + return this.hand; + } @@ -77,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /** + * @param consume should the item be consumed + */ -+ public void setConsumeItem(boolean consume) { ++ public void setConsumeItem(final boolean consume) { + this.consumeItem = consume; + } + @@ -91,17 +89,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * projectile that would be loaded into the crossbow will not be consumed. + */ + @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; + } diff --git a/patches/api/Add-EntityPortalReadyEvent.patch b/patches/api/Add-EntityPortalReadyEvent.patch index e8ca1299eb..b3e363a1a6 100644 --- a/patches/api/Add-EntityPortalReadyEvent.patch +++ b/patches/api/Add-EntityPortalReadyEvent.patch @@ -21,28 +21,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.entity.EntityPortalEvent; +import org.bukkit.event.player.PlayerPortalEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; + +/** + * Called when an entity is ready to be teleported by a plugin. -+ * Currently this is only called after the required ++ * Currently, this is only called after the required + * ticks have passed for a Nether Portal. + *

    + * Cancelling this event resets the entity's readiness + * regarding the current portal. + */ ++@NullMarked +public class EntityPortalReadyEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + + private final PortalType portalType; -+ private World targetWorld; ++ private @Nullable World targetWorld; + + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityPortalReadyEvent(final @NotNull Entity entity, final @Nullable World targetWorld, final @NotNull PortalType portalType) { ++ public EntityPortalReadyEvent(final Entity entity, final @Nullable World targetWorld, final PortalType portalType) { + super(entity); + this.targetWorld = targetWorld; + this.portalType = portalType; @@ -81,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the portal type + */ -+ public @NotNull PortalType getPortalType() { ++ public PortalType getPortalType() { + return this.portalType; + } + @@ -96,11 +97,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public @NotNull HandlerList getHandlers() { ++ public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ public static @NotNull HandlerList getHandlerList() { ++ public static HandlerList getHandlerList() { + return HANDLER_LIST; + } +} diff --git a/patches/api/Add-EntityTeleportEndGatewayEvent.patch b/patches/api/Add-EntityTeleportEndGatewayEvent.patch index 497c6b8b0e..557ae6b07c 100644 --- a/patches/api/Add-EntityTeleportEndGatewayEvent.patch +++ b/patches/api/Add-EntityTeleportEndGatewayEvent.patch @@ -17,17 +17,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.entity.Entity; +import org.bukkit.event.entity.EntityTeleportEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Fired any time an entity attempts to teleport in an end gateway + */ ++@NullMarked +public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent { + -+ @NotNull private final EndGateway gateway; ++ private final EndGateway gateway; + + @ApiStatus.Internal -+ public EntityTeleportEndGatewayEvent(@NotNull Entity entity, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) { ++ public EntityTeleportEndGatewayEvent(final Entity entity, final Location from, final Location to, final EndGateway gateway) { + super(entity, from, to); + this.gateway = gateway; + } @@ -37,7 +38,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return EndGateway used + */ -+ @NotNull + public EndGateway getGateway() { + return this.gateway; + } diff --git a/patches/api/Add-EntityZapEvent.patch b/patches/api/Add-EntityZapEvent.patch index 9f421e0861..856680d690 100644 --- a/patches/api/Add-EntityZapEvent.patch +++ b/patches/api/Add-EntityZapEvent.patch @@ -12,28 +12,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.event.entity; + ++import java.util.Collections; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LightningStrike; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityTransformEvent; -+ -+import java.util.Collections; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Fired when lightning strikes an entity + */ ++@NullMarked +public class EntityZapEvent extends EntityTransformEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ @NotNull private final LightningStrike bolt; ++ private final LightningStrike bolt; + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityZapEvent(@NotNull final Entity entity, @NotNull final LightningStrike bolt, @NotNull final Entity replacementEntity) { ++ public EntityZapEvent(final Entity entity, final LightningStrike bolt, final Entity replacementEntity) { + super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING); + this.bolt = bolt; + } @@ -43,7 +43,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The lightning bolt responsible for this event + */ -+ @NotNull + public LightningStrike getBolt() { + return this.bolt; + } @@ -53,7 +52,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The entity that will replace the struck entity + */ -+ @NotNull + public Entity getReplacementEntity() { + return super.getTransformedEntity(); + } @@ -64,17 +62,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; + } diff --git a/patches/api/Add-GS4-Query-event.patch b/patches/api/Add-GS4-Query-event.patch index 52156b15cb..62c78852a4 100644 --- a/patches/api/Add-GS4-Query-event.patch +++ b/patches/api/Add-GS4-Query-event.patch @@ -14,17 +14,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; -+import org.bukkit.Server; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; ++import org.bukkit.Server; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; + +/** + * This event is fired if server is getting queried over GS4 Query protocol. @@ -33,6 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @author Mark Vainomaa + */ ++@NullMarked +public final class GS4QueryEvent extends Event { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -42,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private QueryResponse response; + + @ApiStatus.Internal -+ public GS4QueryEvent(@NotNull QueryType queryType, @NotNull InetAddress querierAddress, @NotNull QueryResponse response) { ++ public GS4QueryEvent(final QueryType queryType, final InetAddress querierAddress, final QueryResponse response) { + super(true); // should always be called async + this.queryType = queryType; + this.querierAddress = querierAddress; @@ -54,7 +55,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return query type + */ -+ @NotNull + public QueryType getQueryType() { + return this.queryType; + } @@ -64,7 +64,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return querier address + */ -+ @NotNull + public InetAddress getQuerierAddress() { + return this.querierAddress; + } @@ -74,7 +73,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return query response + */ -+ @NotNull + public QueryResponse getResponse() { + return this.response; + } @@ -84,17 +82,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param response query response + */ -+ public void setResponse(@NotNull QueryResponse response) { ++ public void setResponse(final QueryResponse response) { + this.response = Preconditions.checkNotNull(response, "response"); + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } @@ -115,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + FULL + } + -+ public final static class QueryResponse { ++ public static final class QueryResponse { + + private final String motd; + private final String gameVersion; @@ -128,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final String serverVersion; + private final Collection plugins; + -+ private QueryResponse(String motd, String gameVersion, String map, int currentPlayers, int maxPlayers, String hostname, int port, Collection players, String serverVersion, Collection plugins) { ++ private QueryResponse(final String motd, final String gameVersion, final String map, final int currentPlayers, final int maxPlayers, final String hostname, final int port, final Collection players, final String serverVersion, final Collection plugins) { + this.motd = motd; + this.gameVersion = gameVersion; + this.map = map; @@ -142,21 +138,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + /** -+ * Get motd which will be used to reply to the query. By default it is {@link Server#getMotd()}. ++ * Get motd which will be used to reply to the query. By default, it is {@link Server#getMotd()}. + * + * @return motd + */ -+ @NotNull + public String getMotd() { + return this.motd; + } + + /** -+ * Get game version which will be used to reply to the query. By default supported Minecraft versions range is sent. ++ * Get game version which will be used to reply to the query. By default, supported Minecraft versions range is sent. + * + * @return game version + */ -+ @NotNull + public String getGameVersion() { + return this.gameVersion; + } @@ -166,7 +160,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return map name + */ -+ @NotNull + public String getMap() { + return this.map; + } @@ -194,7 +187,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return server hostname + */ -+ @NotNull + public String getHostname() { + return this.hostname; + } @@ -213,7 +205,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return collection of players + */ -+ @NotNull + public Collection getPlayers() { + return this.players; + } @@ -223,7 +214,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return server software + */ -+ @NotNull + public String getServerVersion() { + return this.serverVersion; + } @@ -233,7 +223,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return collection of plugins + */ -+ @NotNull + public Collection getPlugins() { + return this.plugins; + } @@ -243,19 +232,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return {@link QueryResponse} builder + */ -+ @NotNull + public Builder toBuilder() { + return QueryResponse.builder() -+ .motd(getMotd()) -+ .gameVersion(getGameVersion()) -+ .map(getMap()) -+ .currentPlayers(getCurrentPlayers()) -+ .maxPlayers(getMaxPlayers()) -+ .hostname(getHostname()) -+ .port(getPort()) -+ .players(getPlayers()) -+ .serverVersion(getServerVersion()) -+ .plugins(getPlugins()); ++ .motd(this.getMotd()) ++ .gameVersion(this.getGameVersion()) ++ .map(this.getMap()) ++ .currentPlayers(this.getCurrentPlayers()) ++ .maxPlayers(this.getMaxPlayers()) ++ .hostname(this.getHostname()) ++ .port(this.getPort()) ++ .players(this.getPlayers()) ++ .serverVersion(this.getServerVersion()) ++ .plugins(this.getPlugins()); + } + + /** @@ -263,7 +251,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return {@link QueryResponse} builder + */ -+ @NotNull + public static Builder builder() { + return new Builder(); + } @@ -272,11 +259,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * A builder for {@link QueryResponse} objects. + */ + public static final class Builder { -+ private String motd; -+ private String gameVersion; -+ private String map; -+ private String hostname; -+ private String serverVersion; ++ ++ private @MonotonicNonNull String motd; ++ private @MonotonicNonNull String gameVersion; ++ private @MonotonicNonNull String map; ++ private @MonotonicNonNull String hostname; ++ private @MonotonicNonNull String serverVersion; + + private int currentPlayers; + private int maxPlayers; @@ -285,90 +273,77 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final List players = new ArrayList<>(); + private final List plugins = new ArrayList<>(); + -+ private Builder() {} ++ private Builder() { ++ } + -+ @NotNull -+ public Builder motd(@NotNull String motd) { ++ public Builder motd(final String motd) { + this.motd = Preconditions.checkNotNull(motd, "motd"); + return this; + } + -+ @NotNull -+ public Builder gameVersion(@NotNull String gameVersion) { ++ public Builder gameVersion(final String gameVersion) { + this.gameVersion = Preconditions.checkNotNull(gameVersion, "gameVersion"); + return this; + } + -+ @NotNull -+ public Builder map(@NotNull String map) { ++ public Builder map(final String map) { + this.map = Preconditions.checkNotNull(map, "map"); + return this; + } + -+ @NotNull -+ public Builder currentPlayers(int currentPlayers) { ++ public Builder currentPlayers(final int currentPlayers) { + Preconditions.checkArgument(currentPlayers >= 0, "currentPlayers cannot be negative"); + this.currentPlayers = currentPlayers; + return this; + } + -+ @NotNull -+ public Builder maxPlayers(int maxPlayers) { ++ public Builder maxPlayers(final int maxPlayers) { + Preconditions.checkArgument(maxPlayers >= 0, "maxPlayers cannot be negative"); + this.maxPlayers = maxPlayers; + return this; + } + -+ @NotNull -+ public Builder hostname(@NotNull String hostname) { ++ public Builder hostname(final String hostname) { + this.hostname = Preconditions.checkNotNull(hostname, "hostname"); + return this; + } + -+ @NotNull -+ public Builder port(int port) { ++ public Builder port(final int port) { + Preconditions.checkArgument(port >= 1 && port <= 65535, "port must be between 1-65535"); + this.port = port; + return this; + } + -+ @NotNull -+ public Builder players(@NotNull Collection players) { ++ public Builder players(final Collection players) { + this.players.addAll(Preconditions.checkNotNull(players, "players")); + return this; + } + -+ @NotNull -+ public Builder players(@NotNull String... players) { ++ public Builder players(final String... players) { + this.players.addAll(Arrays.asList(Preconditions.checkNotNull(players, "players"))); + return this; + } + -+ @NotNull + public Builder clearPlayers() { + this.players.clear(); + return this; + } + -+ @NotNull -+ public Builder serverVersion(@NotNull String serverVersion) { ++ public Builder serverVersion(final String serverVersion) { + this.serverVersion = Preconditions.checkNotNull(serverVersion, "serverVersion"); + return this; + } + -+ @NotNull -+ public Builder plugins(@NotNull Collection plugins) { ++ public Builder plugins(final Collection plugins) { + this.plugins.addAll(Preconditions.checkNotNull(plugins, "plugins")); + return this; + } + -+ @NotNull -+ public Builder plugins(@NotNull PluginInformation... plugins) { ++ public Builder plugins(final PluginInformation... plugins) { + this.plugins.addAll(Arrays.asList(Preconditions.checkNotNull(plugins, "plugins"))); + return this; + } + -+ @NotNull + public Builder clearPlugins() { + this.plugins.clear(); + return this; @@ -379,19 +354,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return response + */ -+ @NotNull + public QueryResponse build() { + return new QueryResponse( -+ Preconditions.checkNotNull(motd, "motd"), -+ Preconditions.checkNotNull(gameVersion, "gameVersion"), -+ Preconditions.checkNotNull(map, "map"), -+ currentPlayers, -+ maxPlayers, -+ Preconditions.checkNotNull(hostname, "hostname"), -+ port, -+ ImmutableList.copyOf(players), -+ Preconditions.checkNotNull(serverVersion, "serverVersion"), -+ ImmutableList.copyOf(plugins) ++ Preconditions.checkNotNull(this.motd, "motd"), ++ Preconditions.checkNotNull(this.gameVersion, "gameVersion"), ++ Preconditions.checkNotNull(this.map, "map"), ++ this.currentPlayers, ++ this.maxPlayers, ++ Preconditions.checkNotNull(this.hostname, "hostname"), ++ this.port, ++ ImmutableList.copyOf(this.players), ++ Preconditions.checkNotNull(this.serverVersion, "serverVersion"), ++ ImmutableList.copyOf(this.plugins) + ); + } + } @@ -404,31 +378,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private String name; + private String version; + -+ public PluginInformation(@NotNull String name, @NotNull String version) { ++ public PluginInformation(final String name, final String version) { + this.name = Preconditions.checkNotNull(name, "name"); + this.version = Preconditions.checkNotNull(version, "version"); + } + -+ @NotNull + public String getName() { + return this.name; + } + -+ public void setName(@NotNull String name) { ++ public void setName(final String name) { + this.name = name; + } + -+ public void setVersion(@NotNull String version) { ++ public void setVersion(final String version) { + this.version = version; + } + -+ @NotNull + public String getVersion() { + return this.version; + } + -+ @NotNull -+ public static PluginInformation of(@NotNull String name, @NotNull String version) { ++ public static PluginInformation of(final String name, final String version) { + return new PluginInformation(name, version); + } + } diff --git a/patches/api/Add-More-Creeper-API.patch b/patches/api/Add-More-Creeper-API.patch index f2d97ceac7..25edb3c900 100644 --- a/patches/api/Add-More-Creeper-API.patch +++ b/patches/api/Add-More-Creeper-API.patch @@ -17,13 +17,14 @@ 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; + +/** + * Called when a Creeper is ignited either by a + * flint and steel, {@link Creeper#ignite()} or + * {@link Creeper#setIgnited(boolean)}. + */ ++@NullMarked +public class CreeperIgniteEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -32,12 +33,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) { ++ public CreeperIgniteEvent(final Creeper creeper, final boolean ignited) { + super(creeper); + this.ignited = ignited; + } + -+ @NotNull + @Override + public Creeper getEntity() { + return (Creeper) super.getEntity(); @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.ignited; + } + -+ public void setIgnited(boolean ignited) { ++ public void setIgnited(final boolean ignited) { + this.ignited = ignited; + } + @@ -55,17 +55,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.cancelled; + } + -+ 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; + } diff --git a/patches/api/Add-PhantomPreSpawnEvent.patch b/patches/api/Add-PhantomPreSpawnEvent.patch index acf4b22814..053618ad6f 100644 --- a/patches/api/Add-PhantomPreSpawnEvent.patch +++ b/patches/api/Add-PhantomPreSpawnEvent.patch @@ -17,17 +17,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.entity.EntityType; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a phantom is spawned for an exhausted player + */ ++@NullMarked +public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent { + -+ @NotNull private final Entity entity; ++ private final Entity entity; + + @ApiStatus.Internal -+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) { ++ public PhantomPreSpawnEvent(final Location location, final Entity entity, final CreatureSpawnEvent.SpawnReason reason) { + super(location, EntityType.PHANTOM, reason); + this.entity = entity; + } @@ -37,7 +38,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the Entity + */ -+ @NotNull + public Entity getSpawningEntity() { + return this.entity; + } diff --git a/patches/api/Add-PlayerConnectionCloseEvent.patch b/patches/api/Add-PlayerConnectionCloseEvent.patch index d195e2a65c..b0b784a258 100644 --- a/patches/api/Add-PlayerConnectionCloseEvent.patch +++ b/patches/api/Add-PlayerConnectionCloseEvent.patch @@ -41,15 +41,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.event.player; + -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+ +import java.net.InetAddress; +import java.util.UUID; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + *

    @@ -76,16 +75,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * The event may be invoked asynchronously or synchronously. Plugins should check + * {@link Event#isAsynchronous()} and handle accordingly. + */ ++@NullMarked +public class PlayerConnectionCloseEvent extends Event { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ @NotNull private final UUID playerUniqueId; -+ @NotNull private final String playerName; -+ @NotNull private final InetAddress ipAddress; ++ private final UUID playerUniqueId; ++ private final String playerName; ++ private final InetAddress ipAddress; + + @ApiStatus.Internal -+ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) { ++ public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final InetAddress ipAddress, final boolean async) { + super(async); + this.playerUniqueId = playerUniqueId; + this.playerName = playerName; @@ -95,7 +95,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /** + * Returns the {@code UUID} of the player disconnecting. + */ -+ @NotNull + public UUID getPlayerUniqueId() { + return this.playerUniqueId; + } @@ -103,7 +102,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /** + * Returns the name of the player disconnecting. + */ -+ @NotNull + public String getPlayerName() { + return this.playerName; + } @@ -111,18 +109,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /** + * Returns the player's IP address. + */ -+ @NotNull + public InetAddress getIpAddress() { + return this.ipAddress; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } diff --git a/patches/api/Add-PlayerShearBlockEvent.patch b/patches/api/Add-PlayerShearBlockEvent.patch index aeb51b79b3..7e0edab036 100644 --- a/patches/api/Add-PlayerShearBlockEvent.patch +++ b/patches/api/Add-PlayerShearBlockEvent.patch @@ -12,6 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package io.papermc.paper.event.block; + ++import java.util.List; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; @@ -20,9 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.List; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a player uses sheers on a block. @@ -32,6 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + *

    + * Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb. + */ ++@NullMarked +public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public PlayerShearBlockEvent(@NotNull Player player, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List drops) { ++ public PlayerShearBlockEvent(final Player player, final Block block, final ItemStack item, final EquipmentSlot hand, final List drops) { + super(player); + this.block = block; + this.item = item; @@ -57,7 +57,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The {@link Block} which block is being sheared in this event. + */ -+ @NotNull + public Block getBlock() { + return this.block; + } @@ -67,7 +66,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The {@link ItemStack} of the shears. + */ -+ @NotNull + public ItemStack getItem() { + return this.item; + } @@ -77,7 +75,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return Either {@link EquipmentSlot#HAND} OR {@link EquipmentSlot#OFF_HAND}. + */ -+ @NotNull + public EquipmentSlot getHand() { + return this.hand; + } @@ -85,9 +82,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /** + * Gets the resulting drops of this event. + * -+ * @return A {@link List list} of {@link ItemStack items} that will be dropped as result of this event. ++ * @return A mutable {@link List list} of {@link ItemStack items} that will be dropped as result of this event. + */ -+ @NotNull + public List getDrops() { + return this.drops; + } @@ -108,17 +104,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param cancel whether the shearing of the block should be cancelled or not. + */ + @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; + } diff --git a/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch index 252a80e611..066f7b008b 100644 --- a/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch +++ b/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch @@ -58,18 +58,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; + +/** + * Called when an item is put in an inventory containing a result slot + */ ++@NullMarked +public class PrepareResultEvent extends PrepareInventoryResultEvent { + + // HandlerList on PrepareInventoryResultEvent to ensure api compat + + @ApiStatus.Internal -+ public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { ++ public PrepareResultEvent(final InventoryView inventory, final @Nullable ItemStack result) { + super(inventory, result); + } + @@ -78,8 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return result item + */ -+ @Nullable -+ public ItemStack getResult() { ++ public @Nullable ItemStack getResult() { + return super.getResult(); + } + @@ -88,7 +88,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param result result item + */ -+ public void setResult(@Nullable ItemStack result) { ++ public void setResult(final @Nullable ItemStack result) { + super.setResult(result); + } +} diff --git a/patches/api/Add-PufferFishStateChangeEvent.patch b/patches/api/Add-PufferFishStateChangeEvent.patch index d80049ff4e..da5161715a 100644 --- a/patches/api/Add-PufferFishStateChangeEvent.patch +++ b/patches/api/Add-PufferFishStateChangeEvent.patch @@ -17,11 +17,12 @@ 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; + +/** + * Called just before a {@link PufferFish} inflates or deflates. + */ ++@NullMarked +public class PufferFishStateChangeEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -30,12 +31,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public PufferFishStateChangeEvent(@NotNull PufferFish entity, int newPuffState) { ++ public PufferFishStateChangeEvent(final PufferFish entity, final int newPuffState) { + super(entity); + this.newPuffState = newPuffState; + } + -+ @NotNull + @Override + public PufferFish getEntity() { + return (PufferFish) super.getEntity(); @@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param cancel {@code true} if you wish to cancel the (in/de)flation + */ + @Override -+ public void setCancelled(boolean cancel) { ++ public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + @@ -86,13 +86,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.cancelled; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } diff --git a/patches/api/Add-ShulkerDuplicateEvent.patch b/patches/api/Add-ShulkerDuplicateEvent.patch index 5336040586..eb4e07b70c 100644 --- a/patches/api/Add-ShulkerDuplicateEvent.patch +++ b/patches/api/Add-ShulkerDuplicateEvent.patch @@ -17,13 +17,14 @@ 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 a shulker duplicates itself by spawning a new shulker. + *

    + * The event is fired prior to the newly created shulker, accessible via {@link #getEntity()}, being added to the world. + */ ++@NullMarked +public class ShulkerDuplicateEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -32,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public ShulkerDuplicateEvent(@NotNull Shulker child, @NotNull Shulker parent) { ++ public ShulkerDuplicateEvent(final Shulker child, final Shulker parent) { + super(child); + this.parent = parent; + } @@ -44,7 +45,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return the newly duplicated shulker. + */ + @Override -+ @NotNull + public Shulker getEntity() { + return (Shulker) super.getEntity(); + } @@ -55,7 +55,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the previously existing shulker which duplicated. + */ -+ @NotNull + public Shulker getParent() { + return this.parent; + } @@ -66,17 +65,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; + } diff --git a/patches/api/Add-TameableDeathMessageEvent.patch b/patches/api/Add-TameableDeathMessageEvent.patch index 69049c2934..a696f088f1 100644 --- a/patches/api/Add-TameableDeathMessageEvent.patch +++ b/patches/api/Add-TameableDeathMessageEvent.patch @@ -18,11 +18,12 @@ 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; + +/** + * Called when a {@link Tameable} dies and sends a death message. + */ ++@NullMarked +public class TameableDeathMessageEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -31,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean cancelled; + + @ApiStatus.Internal -+ public TameableDeathMessageEvent(@NotNull Tameable tameable, @NotNull Component deathMessage) { ++ public TameableDeathMessageEvent(final Tameable tameable, final Component deathMessage) { + super(tameable); + this.deathMessage = deathMessage; + } @@ -41,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param deathMessage Death message to appear + */ -+ public void deathMessage(@NotNull Component deathMessage) { ++ public void deathMessage(final Component deathMessage) { + this.deathMessage = deathMessage; + } + @@ -50,12 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return Death message to appear + */ -+ @NotNull + public Component deathMessage() { + return this.deathMessage; + } + -+ @NotNull + @Override + public Tameable getEntity() { + return (Tameable) super.getEntity(); @@ -67,17 +66,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; + } diff --git a/patches/api/Add-TargetHitEvent-API.patch b/patches/api/Add-TargetHitEvent-API.patch index 9ddfd8c4d9..fb7d945401 100644 --- a/patches/api/Add-TargetHitEvent-API.patch +++ b/patches/api/Add-TargetHitEvent-API.patch @@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Range; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a Target Block is hit by a projectile. @@ -29,6 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * and in the case that the shooter is a player, will stop them from receiving + * advancement criteria. + */ ++@NullMarked +public class TargetHitEvent extends ProjectileHitEvent { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -36,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private int signalStrength; + + @ApiStatus.Internal -+ public TargetHitEvent(@NotNull Projectile projectile, @NotNull Block block, @NotNull BlockFace blockFace, int signalStrength) { ++ public TargetHitEvent(final Projectile projectile, final Block block, final BlockFace blockFace, final int signalStrength) { + super(projectile, null, block, blockFace); + this.signalStrength = signalStrength; + } @@ -55,18 +56,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param signalStrength the strength of the redstone signal to be emitted + */ -+ public void setSignalStrength(@Range(from = 0, to = 15) int signalStrength) { ++ public void setSignalStrength(final @Range(from = 0, to = 15) int signalStrength) { + Preconditions.checkArgument(signalStrength >= 0 && signalStrength <= 15, "Signal strength out of range (%s), must be in range [0,15]", signalStrength); + this.signalStrength = signalStrength; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } diff --git a/patches/api/Add-ThrownEggHatchEvent.patch b/patches/api/Add-ThrownEggHatchEvent.patch index 52e8097808..4398dfba7e 100644 --- a/patches/api/Add-ThrownEggHatchEvent.patch +++ b/patches/api/Add-ThrownEggHatchEvent.patch @@ -20,13 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Called when a thrown egg might hatch. + *

    + * This event fires for all thrown eggs that may hatch, players, dispensers, etc. + */ ++@NullMarked +public class ThrownEggHatchEvent extends Event { + + private static final HandlerList HANDLER_LIST = new HandlerList(); @@ -37,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private EntityType hatchType; + + @ApiStatus.Internal -+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) { ++ public ThrownEggHatchEvent(final Egg egg, final boolean hatching, final byte numHatches, final EntityType hatchingType) { + this.egg = egg; + this.hatching = hatching; + this.numHatches = numHatches; @@ -49,7 +50,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return the egg involved in this event + */ -+ @NotNull + public Egg getEgg() { + return this.egg; + } @@ -68,9 +68,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Sets whether the egg will hatch or not. + * + * @param hatching {@code true} if you want the egg to hatch, {@code false} if you want it -+ * not to ++ * not to + */ -+ public void setHatching(boolean hatching) { ++ public void setHatching(final boolean hatching) { + this.hatching = hatching; + } + @@ -79,7 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The type of the mob being hatched by the egg + */ -+ @NotNull + public EntityType getHatchingType() { + return this.hatchType; + } @@ -89,13 +88,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param hatchType The type of the mob being hatched by the egg + */ -+ public void setHatchingType(@NotNull EntityType hatchType) { ++ public void setHatchingType(final EntityType hatchType) { + Preconditions.checkArgument(hatchType.isSpawnable(), "Can't spawn that entity type from an egg!"); + this.hatchType = hatchType; + } + + /** -+ * Get the number of mob hatches from the egg. By default the number will ++ * Get the number of mob hatches from the egg. By default, the number will + * be the number the server would've done + *