mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Begin switching to JSpecify annotations (#11448)
* Begin switching to JSpecify annotations * more * fixes
This commit is contained in:
parent
fa1f6a5d78
commit
64e918335c
62 changed files with 580 additions and 750 deletions
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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.
|
||||
+ * <p>
|
||||
+ * 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<ItemStack> drops;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List<ItemStack> drops) {
|
||||
+ public BlockBreakBlockEvent(final Block block, final Block source, final List<ItemStack> 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<ItemStack> 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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -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.
|
||||
+ * <br>
|
||||
+ * 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;
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -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
|
|||
+ * <li>Sniffers producing the {@link Material#SNIFFER_EGG} item, which needs to be placed before it can begin to hatch.</li>
|
||||
+ * <li>A turtle being marked with "HasEgg" and laying a {@link Material#TURTLE_EGG} later.</li>
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * 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;
|
||||
+ }
|
||||
|
|
|
@ -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
|
|||
+ * <li>Wither rose</li>
|
||||
+ * </ul>
|
||||
+ */
|
||||
+@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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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.
|
||||
+ * <p>
|
||||
+ * 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;
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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<PluginInformation> plugins;
|
||||
+
|
||||
+ private QueryResponse(String motd, String gameVersion, String map, int currentPlayers, int maxPlayers, String hostname, int port, Collection<String> players, String serverVersion, Collection<PluginInformation> 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<String> players, final String serverVersion, final Collection<PluginInformation> 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<String> 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<PluginInformation> 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<String> players = new ArrayList<>();
|
||||
+ private final List<PluginInformation> 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<String> players) {
|
||||
+ public Builder players(final Collection<String> 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<PluginInformation> plugins) {
|
||||
+ public Builder plugins(final Collection<PluginInformation> 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);
|
||||
+ }
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+
|
||||
+/**
|
||||
+ * <p>
|
||||
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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
|
|||
+ * <p>
|
||||
+ * 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<ItemStack> drops) {
|
||||
+ public PlayerShearBlockEvent(final Player player, final Block block, final ItemStack item, final EquipmentSlot hand, final List<ItemStack> 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<ItemStack> 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;
|
||||
+ }
|
||||
|
|
|
@ -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);
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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.
|
||||
+ * <p>
|
||||
+ * 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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+ }
|
||||
|
|
|
@ -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.
|
||||
+ * <p>
|
||||
+ * 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
|
||||
+ * <ul>
|
||||
+ * <li>7/8 chance of being 0
|
||||
|
@ -117,17 +116,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param numHatches The number of mobs coming out of the egg
|
||||
+ */
|
||||
+ public void setNumHatches(byte numHatches) {
|
||||
+ public void setNumHatches(final byte numHatches) {
|
||||
+ this.numHatches = numHatches;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -21,14 +21,15 @@ 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.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..00000000000000000000000000000000
|
|||
+ 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..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return triggering entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getTarget() {
|
||||
+ return this.target;
|
||||
+ }
|
||||
|
@ -63,8 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @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..00000000000000000000000000000000
|
|||
+ * @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..00000000000000000000000000000000
|
|||
+ * 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..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;
|
||||
+ }
|
||||
|
|
|
@ -23,28 +23,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+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..00000000000000000000000000000000
|
|||
+ * @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..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @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..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @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..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the entities
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getToRehydrate() {
|
||||
+ return this.rehydrate;
|
||||
+ }
|
||||
|
@ -107,7 +106,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return entities to be extinguished
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getToExtinguish() {
|
||||
+ return this.extinguish;
|
||||
+ }
|
||||
|
@ -118,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ */
|
||||
+ @Deprecated(since = "1.19.3")
|
||||
+ @Override
|
||||
+ public @NotNull Collection<LivingEntity> getAffectedEntities() {
|
||||
+ public Collection<LivingEntity> getAffectedEntities() {
|
||||
+ return super.getAffectedEntities();
|
||||
+ }
|
||||
+
|
||||
|
@ -130,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ */
|
||||
+ @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..00000000000000000000000000000000
|
|||
+ */
|
||||
+ @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);
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -15,13 +15,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;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired when whitelist is toggled
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class WhitelistToggleEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -29,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private final boolean enabled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WhitelistToggleEvent(boolean enabled) {
|
||||
+ public WhitelistToggleEvent(final boolean enabled) {
|
||||
+ this.enabled = enabled;
|
||||
+ }
|
||||
+
|
||||
|
@ -42,13 +43,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.enabled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -23,19 +23,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity is knocked back by the hit of another Entity. The acceleration
|
||||
+ * vector can be modified. If this event is cancelled, the entity is not knocked back.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityKnockbackByEntityEvent extends EntityPushedByEntityAttackEvent {
|
||||
+
|
||||
+ private final float knockbackStrength;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityKnockbackByEntityEvent(final @NonNull LivingEntity entity, final @NonNull Entity hitBy, final EntityKnockbackEvent.@NonNull Cause cause, final float knockbackStrength, final @NonNull Vector knockback) {
|
||||
+ public EntityKnockbackByEntityEvent(final LivingEntity entity, final Entity hitBy, final EntityKnockbackEvent.Cause cause, final float knockbackStrength, final Vector knockback) {
|
||||
+ super(entity, cause, hitBy, knockback);
|
||||
+ this.knockbackStrength = knockbackStrength;
|
||||
+ }
|
||||
|
@ -44,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return the entity which was knocked back
|
||||
+ */
|
||||
+ @Override
|
||||
+ public @NonNull LivingEntity getEntity() {
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
|
@ -62,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the Entity which hit
|
||||
+ */
|
||||
+ public @NonNull Entity getHitBy() {
|
||||
+ public Entity getHitBy() {
|
||||
+ return super.getPushedBy();
|
||||
+ }
|
||||
+
|
||||
|
@ -81,14 +82,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity receives knockback.
|
||||
+ * @see EntityPushedByEntityAttackEvent
|
||||
+ * @see com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityKnockbackEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -98,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityKnockbackEvent(final @NonNull Entity entity, final EntityKnockbackEvent.@NonNull Cause cause, final @NonNull Vector knockback) {
|
||||
+ public EntityKnockbackEvent(final Entity entity, final EntityKnockbackEvent.Cause cause, final Vector knockback) {
|
||||
+ super(entity);
|
||||
+ this.cause = cause;
|
||||
+ this.knockback = knockback;
|
||||
|
@ -109,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the cause of the knockback
|
||||
+ */
|
||||
+ public EntityKnockbackEvent.@NonNull Cause getCause() {
|
||||
+ public EntityKnockbackEvent.Cause getCause() {
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
|
@ -121,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the knockback
|
||||
+ */
|
||||
+ public @NonNull Vector getKnockback() {
|
||||
+ public Vector getKnockback() {
|
||||
+ return this.knockback.clone();
|
||||
+ }
|
||||
+
|
||||
|
@ -130,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param knockback the knockback
|
||||
+ */
|
||||
+ public void setKnockback(final @NonNull Vector knockback) {
|
||||
+ public void setKnockback(final Vector knockback) {
|
||||
+ Preconditions.checkArgument(knockback != null, "knockback");
|
||||
+ this.knockback = knockback.clone();
|
||||
+ }
|
||||
|
@ -146,11 +148,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull HandlerList getHandlers() {
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static @NonNull HandlerList getHandlerList() {
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
|
@ -200,8 +202,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an entity is pushed by another entity's attack. The acceleration vector can be
|
||||
|
@ -210,12 +212,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * Note: Some entities might trigger this multiple times on the same entity
|
||||
+ * as multiple acceleration calculations are done.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityPushedByEntityAttackEvent extends EntityKnockbackEvent implements Cancellable {
|
||||
+
|
||||
+ private final Entity pushedBy;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPushedByEntityAttackEvent(final @NonNull Entity entity, final EntityKnockbackEvent.@NonNull Cause cause, final @NonNull Entity pushedBy, final @NonNull Vector knockback) {
|
||||
+ public EntityPushedByEntityAttackEvent(final Entity entity, final EntityKnockbackEvent.Cause cause, final Entity pushedBy, final Vector knockback) {
|
||||
+ super(entity, cause, knockback);
|
||||
+ this.pushedBy = pushedBy;
|
||||
+ }
|
||||
|
@ -225,7 +228,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the pushing entity
|
||||
+ */
|
||||
+ public @NonNull Entity getPushedBy() {
|
||||
+ public Entity getPushedBy() {
|
||||
+ return this.pushedBy;
|
||||
+ }
|
||||
+
|
||||
|
@ -236,7 +239,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @deprecated use {@link #getKnockback()}
|
||||
+ */
|
||||
+ @Deprecated(since = "1.20.6", forRemoval = true)
|
||||
+ public @NonNull Vector getAcceleration() {
|
||||
+ public Vector getAcceleration() {
|
||||
+ return this.knockback; // TODO Clone in 1.21 to not instantly break what was technically already modifiable (call super.getKnockback())
|
||||
+ }
|
||||
+
|
||||
|
@ -247,7 +250,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @deprecated use {@link #setKnockback(Vector)}
|
||||
+ */
|
||||
+ @Deprecated(since = "1.20.6", forRemoval = true)
|
||||
+ public void setAcceleration(final @NonNull Vector acceleration) {
|
||||
+ public void setAcceleration(final Vector acceleration) {
|
||||
+ super.setKnockback(acceleration);
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -14,6 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import java.util.UUID;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
@ -21,10 +22,8 @@ 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.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired during a player handshake.
|
||||
|
@ -34,16 +33,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p>
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerHandshakeEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final String originalHandshake;
|
||||
+ @NotNull private final String originalSocketAddressHostname;
|
||||
+ @Nullable private String serverHostname;
|
||||
+ @Nullable private String socketAddressHostname;
|
||||
+ @Nullable private UUID uniqueId;
|
||||
+ @Nullable private String propertiesJson;
|
||||
+ private final String originalHandshake;
|
||||
+ private final String originalSocketAddressHostname;
|
||||
+ private @Nullable String serverHostname;
|
||||
+ private @Nullable String socketAddressHostname;
|
||||
+ private @Nullable UUID uniqueId;
|
||||
+ private @Nullable String propertiesJson;
|
||||
+ private boolean failed;
|
||||
+ private Component failMessage = Component.text("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!", NamedTextColor.YELLOW);
|
||||
+
|
||||
|
@ -51,12 +51,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
|
||||
+ public PlayerHandshakeEvent(final String originalHandshake, final boolean cancelled) {
|
||||
+ this(originalHandshake, "127.0.0.1", cancelled);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, @NotNull String originalSocketAddressHostname, boolean cancelled) {
|
||||
+ public PlayerHandshakeEvent(final String originalHandshake, final String originalSocketAddressHostname, final boolean cancelled) {
|
||||
+ super(true);
|
||||
+ this.originalHandshake = originalHandshake;
|
||||
+ this.originalSocketAddressHostname = originalSocketAddressHostname;
|
||||
|
@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @param cancel {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
|
@ -94,7 +94,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the original handshake string
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getOriginalHandshake() {
|
||||
+ return this.originalHandshake;
|
||||
+ }
|
||||
|
@ -107,7 +106,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the original socket address hostname
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getOriginalSocketAddressHostname() {
|
||||
+ return this.originalSocketAddressHostname;
|
||||
+ }
|
||||
|
@ -119,8 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the server hostname string
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getServerHostname() {
|
||||
+ public @Nullable String getServerHostname() {
|
||||
+ return this.serverHostname;
|
||||
+ }
|
||||
+
|
||||
|
@ -131,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param serverHostname the server hostname string
|
||||
+ */
|
||||
+ public void setServerHostname(@NotNull String serverHostname) {
|
||||
+ public void setServerHostname(final String serverHostname) {
|
||||
+ this.serverHostname = serverHostname;
|
||||
+ }
|
||||
+
|
||||
|
@ -142,8 +139,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the socket address hostname string
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getSocketAddressHostname() {
|
||||
+ public @Nullable String getSocketAddressHostname() {
|
||||
+ return this.socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
|
@ -154,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param socketAddressHostname the socket address hostname string
|
||||
+ */
|
||||
+ public void setSocketAddressHostname(@NotNull String socketAddressHostname) {
|
||||
+ public void setSocketAddressHostname(final String socketAddressHostname) {
|
||||
+ this.socketAddressHostname = socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
|
@ -163,8 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the unique id
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public UUID getUniqueId() {
|
||||
+ public @Nullable UUID getUniqueId() {
|
||||
+ return this.uniqueId;
|
||||
+ }
|
||||
+
|
||||
|
@ -173,7 +168,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param uniqueId the unique id
|
||||
+ */
|
||||
+ public void setUniqueId(@NotNull UUID uniqueId) {
|
||||
+ public void setUniqueId(final UUID uniqueId) {
|
||||
+ this.uniqueId = uniqueId;
|
||||
+ }
|
||||
+
|
||||
|
@ -184,8 +179,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the profile properties, as JSON
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getPropertiesJson() {
|
||||
+ public @Nullable String getPropertiesJson() {
|
||||
+ return this.propertiesJson;
|
||||
+ }
|
||||
+
|
||||
|
@ -209,7 +203,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param failed {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
+ public void setFailed(boolean failed) {
|
||||
+ public void setFailed(final boolean failed) {
|
||||
+ this.failed = failed;
|
||||
+ }
|
||||
+
|
||||
|
@ -220,7 +214,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param propertiesJson the profile properties, as JSON
|
||||
+ */
|
||||
+ public void setPropertiesJson(@NotNull String propertiesJson) {
|
||||
+ public void setPropertiesJson(final String propertiesJson) {
|
||||
+ this.propertiesJson = propertiesJson;
|
||||
+ }
|
||||
+
|
||||
|
@ -229,7 +223,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the message to display to the client
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Component failMessage() {
|
||||
+ return this.failMessage;
|
||||
+ }
|
||||
|
@ -239,7 +232,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param failMessage the message to display to the client
|
||||
+ */
|
||||
+ public void failMessage(@NotNull Component failMessage) {
|
||||
+ public void failMessage(final Component failMessage) {
|
||||
+ this.failMessage = failMessage;
|
||||
+ }
|
||||
+
|
||||
|
@ -249,7 +242,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return the message to display to the client
|
||||
+ * @deprecated use {@link #failMessage()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated
|
||||
+ public String getFailMessage() {
|
||||
+ return LegacyComponentSerializer.legacySection().serialize(this.failMessage());
|
||||
|
@ -262,18 +254,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @deprecated use {@link #failMessage(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setFailMessage(@NotNull String failMessage) {
|
||||
+ public void setFailMessage(final String failMessage) {
|
||||
+ Preconditions.checkArgument(failMessage != null && !failMessage.isEmpty(), "fail message cannot be null or empty");
|
||||
+ this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage));
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -19,22 +19,23 @@ 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;
|
||||
+
|
||||
+/**
|
||||
+ * This event gets called when the whitelist status of a player is changed
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class WhitelistStateUpdateEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final PlayerProfile playerProfile;
|
||||
+ @NotNull private final WhitelistStatus status;
|
||||
+ private final PlayerProfile playerProfile;
|
||||
+ private final WhitelistStatus status;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WhitelistStateUpdateEvent(@NotNull PlayerProfile playerProfile, @NotNull WhitelistStatus status) {
|
||||
+ public WhitelistStateUpdateEvent(final PlayerProfile playerProfile, final WhitelistStatus status) {
|
||||
+ this.playerProfile = playerProfile;
|
||||
+ this.status = status;
|
||||
+ }
|
||||
|
@ -44,7 +45,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the player whose status is being changed
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public OfflinePlayer getPlayer() {
|
||||
+ return Bukkit.getOfflinePlayer(this.playerProfile.getId());
|
||||
+ }
|
||||
|
@ -54,7 +54,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the player profile whose status is being changed
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return this.playerProfile;
|
||||
+ }
|
||||
|
@ -64,7 +63,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the whitelist status
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public WhitelistStatus getStatus() {
|
||||
+ return this.status;
|
||||
+ }
|
||||
|
@ -75,17 +73,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;
|
||||
+ }
|
||||
|
|
|
@ -18,7 +18,7 @@ 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.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item on or used by an entity takes durability damage as a result of being hit/used.
|
||||
|
@ -26,6 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * NOTE: default vanilla behaviour dictates that armor/tools picked up by
|
||||
+ * mobs do not take damage (except via Thorns).
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityDamageItemEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -36,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityDamageItemEvent(@NotNull Entity entity, @NotNull ItemStack item, int damage) {
|
||||
+ public EntityDamageItemEvent(final Entity entity, final ItemStack item, final int damage) {
|
||||
+ super(entity);
|
||||
+ this.item = item;
|
||||
+ this.damage = damage;
|
||||
|
@ -47,7 +48,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the item
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return this.item;
|
||||
+ }
|
||||
|
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param damage the damage amount to cause
|
||||
+ */
|
||||
+ public void setDamage(int damage) {
|
||||
+ public void setDamage(final int damage) {
|
||||
+ this.damage = damage;
|
||||
+ }
|
||||
+
|
||||
|
@ -76,17 +76,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;
|
||||
+ }
|
||||
|
|
|
@ -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;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when an entity sits down or stands up.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityToggleSitEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -30,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityToggleSitEvent(@NotNull Entity entity, boolean isSitting) {
|
||||
+ public EntityToggleSitEvent(final Entity entity, final boolean isSitting) {
|
||||
+ super(entity);
|
||||
+ this.isSitting = isSitting;
|
||||
+ }
|
||||
|
@ -50,17 +51,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;
|
||||
+ }
|
||||
|
|
|
@ -15,13 +15,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload)
|
||||
+ * <p>
|
||||
+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class ServerResourcesReloadedEvent extends ServerEvent {
|
||||
+
|
||||
+ public static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -29,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private final Cause cause;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerResourcesReloadedEvent(@NotNull Cause cause) {
|
||||
+ public ServerResourcesReloadedEvent(final Cause cause) {
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
+
|
||||
|
@ -38,17 +39,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the reload cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
|
|
|
@ -20,12 +20,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.inventory.AnvilInventory;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+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 anvil is damaged from being used
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class AnvilDamagedEvent extends InventoryEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -34,12 +35,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public AnvilDamagedEvent(@NotNull InventoryView inventory, @Nullable BlockData blockData) {
|
||||
+ public AnvilDamagedEvent(final InventoryView inventory, final @Nullable BlockData blockData) {
|
||||
+ super(inventory);
|
||||
+ this.damageState = DamageState.getState(blockData);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public AnvilInventory getInventory() {
|
||||
+ return (AnvilInventory) super.getInventory();
|
||||
|
@ -50,7 +50,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Damage state
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DamageState getDamageState() {
|
||||
+ return this.damageState;
|
||||
+ }
|
||||
|
@ -60,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param damageState Damage state
|
||||
+ */
|
||||
+ public void setDamageState(@NotNull DamageState damageState) {
|
||||
+ public void setDamageState(final DamageState damageState) {
|
||||
+ this.damageState = damageState;
|
||||
+ }
|
||||
+
|
||||
|
@ -78,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param breaking {@code true} if breaking
|
||||
+ */
|
||||
+ public void setBreaking(boolean breaking) {
|
||||
+ public void setBreaking(final boolean breaking) {
|
||||
+ if (breaking) {
|
||||
+ this.damageState = DamageState.BROKEN;
|
||||
+ } else if (this.damageState == DamageState.BROKEN) {
|
||||
|
@ -92,16 +91,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;
|
||||
+ }
|
||||
|
@ -117,7 +114,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ private final Material material;
|
||||
+
|
||||
+ DamageState(@NotNull Material material) {
|
||||
+ DamageState(final Material material) {
|
||||
+ this.material = material;
|
||||
+ }
|
||||
+
|
||||
|
@ -126,7 +123,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Material
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getMaterial() {
|
||||
+ return this.material;
|
||||
+ }
|
||||
|
@ -138,8 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return DamageState
|
||||
+ * @throws IllegalArgumentException If non anvil block data is given
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static DamageState getState(@Nullable BlockData blockData) {
|
||||
+ public static DamageState getState(final @Nullable BlockData blockData) {
|
||||
+ return blockData == null ? BROKEN : getState(blockData.getMaterial());
|
||||
+ }
|
||||
+
|
||||
|
@ -150,12 +145,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return DamageState
|
||||
+ * @throws IllegalArgumentException If non anvil material is given
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static DamageState getState(@Nullable Material material) {
|
||||
+ public static DamageState getState(final @Nullable Material material) {
|
||||
+ if (material == null) {
|
||||
+ return BROKEN;
|
||||
+ }
|
||||
+ for (DamageState state : values()) {
|
||||
+ for (final DamageState state : values()) {
|
||||
+ if (state.getMaterial() == material) {
|
||||
+ return state;
|
||||
+ }
|
||||
|
|
|
@ -48,6 +48,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import io.papermc.paper.util.TransformingRandomAccessList;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.Objects;
|
||||
+import java.util.stream.Stream;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.examination.Examinable;
|
||||
+import net.kyori.examination.ExaminableProperty;
|
||||
|
@ -58,14 +62,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.Objects;
|
||||
+import java.util.stream.Stream;
|
||||
+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;
|
||||
+
|
||||
+/**
|
||||
+ * Allows plugins to compute tab completion results asynchronously.
|
||||
|
@ -76,15 +75,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * <p>
|
||||
+ * Only 1 process will be allowed to provide completions, the Async Event, or the standard process.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class AsyncTabCompleteEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final CommandSender sender;
|
||||
+ @NotNull private final String buffer;
|
||||
+ private final CommandSender sender;
|
||||
+ private final String buffer;
|
||||
+ private final boolean isCommand;
|
||||
+ @Nullable
|
||||
+ private final Location location;
|
||||
+ private final @Nullable Location location;
|
||||
+ private final List<Completion> completions = new ArrayList<>();
|
||||
+ private final List<String> stringCompletions = new TransformingRandomAccessList<>(
|
||||
+ this.completions,
|
||||
|
@ -95,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
|
||||
+ public AsyncTabCompleteEvent(final CommandSender sender, final String buffer, final boolean isCommand, final @Nullable Location loc) {
|
||||
+ super(true);
|
||||
+ this.sender = sender;
|
||||
+ this.buffer = buffer;
|
||||
|
@ -105,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull List<String> completions, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
|
||||
+ public AsyncTabCompleteEvent(final CommandSender sender, final List<String> completions, final String buffer, final boolean isCommand, final @Nullable Location loc) {
|
||||
+ super(true);
|
||||
+ this.sender = sender;
|
||||
+ this.completions.addAll(fromStrings(completions));
|
||||
|
@ -119,7 +118,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the {@link CommandSender} instance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CommandSender getSender() {
|
||||
+ return this.sender;
|
||||
+ }
|
||||
|
@ -134,7 +132,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return a list of offered completions
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public List<String> getCompletions() {
|
||||
+ return this.stringCompletions;
|
||||
+ }
|
||||
|
@ -149,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param completions the new completions
|
||||
+ */
|
||||
+ public void setCompletions(@NotNull List<String> completions) {
|
||||
+ public void setCompletions(final List<String> completions) {
|
||||
+ Preconditions.checkArgument(completions != null, "Completions list cannot be null");
|
||||
+ if (completions == this.stringCompletions) {
|
||||
+ return;
|
||||
|
@ -168,7 +165,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return a list of offered completions
|
||||
+ */
|
||||
+ public @NotNull List<Completion> completions() {
|
||||
+ public List<Completion> completions() {
|
||||
+ return this.completions;
|
||||
+ }
|
||||
+
|
||||
|
@ -182,7 +179,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param newCompletions the new completions
|
||||
+ */
|
||||
+ public void completions(final @NotNull List<Completion> newCompletions) {
|
||||
+ public void completions(final List<Completion> newCompletions) {
|
||||
+ Preconditions.checkArgument(newCompletions != null, "new completions cannot be null");
|
||||
+ this.completions.clear();
|
||||
+ this.completions.addAll(newCompletions);
|
||||
|
@ -193,7 +190,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return command buffer, as entered
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getBuffer() {
|
||||
+ return this.buffer;
|
||||
+ }
|
||||
|
@ -208,8 +204,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The position looked at by the sender, or {@code null} if none
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getLocation() {
|
||||
+ public @Nullable Location getLocation() {
|
||||
+ return this.location != null ? this.location.clone() : null;
|
||||
+ }
|
||||
+
|
||||
|
@ -230,7 +225,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param handled if this completion should be marked as being handled
|
||||
+ */
|
||||
+ public void setHandled(boolean handled) {
|
||||
+ public void setHandled(final boolean handled) {
|
||||
+ this.handled = handled;
|
||||
+ }
|
||||
+
|
||||
|
@ -245,21 +240,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * Will provide no completions, and will not fire the synchronous process
|
||||
+ */
|
||||
+ @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;
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull List<Completion> fromStrings(final @NotNull List<String> suggestions) {
|
||||
+ private static List<Completion> fromStrings(final List<String> suggestions) {
|
||||
+ final List<Completion> list = new ArrayList<>(suggestions.size());
|
||||
+ for (final String suggestion : suggestions) {
|
||||
+ list.add(new CompletionImpl(suggestion, null));
|
||||
|
@ -277,7 +270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return suggestion string
|
||||
+ */
|
||||
+ @NotNull String suggestion();
|
||||
+ String suggestion();
|
||||
+
|
||||
+ /**
|
||||
+ * Get the suggestion tooltip for this {@link Completion}.
|
||||
|
@ -287,7 +280,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Nullable Component tooltip();
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull Stream<? extends ExaminableProperty> examinableProperties() {
|
||||
+ default Stream<? extends ExaminableProperty> examinableProperties() {
|
||||
+ return Stream.of(ExaminableProperty.of("suggestion", this.suggestion()), ExaminableProperty.of("tooltip", this.tooltip()));
|
||||
+ }
|
||||
+
|
||||
|
@ -297,7 +290,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @param suggestion suggestion string
|
||||
+ * @return new completion instance
|
||||
+ */
|
||||
+ static @NotNull Completion completion(final @NotNull String suggestion) {
|
||||
+ static Completion completion(final String suggestion) {
|
||||
+ return new CompletionImpl(suggestion, null);
|
||||
+ }
|
||||
+
|
||||
|
@ -310,7 +303,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @param tooltip tooltip component, or {@code null}
|
||||
+ * @return new completion instance
|
||||
+ */
|
||||
+ static @NotNull Completion completion(final @NotNull String suggestion, final @Nullable Component tooltip) {
|
||||
+ static Completion completion(final String suggestion, final @Nullable Component tooltip) {
|
||||
+ return new CompletionImpl(suggestion, tooltip);
|
||||
+ }
|
||||
+ }
|
||||
|
@ -319,15 +312,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ static final class CompletionImpl implements Completion {
|
||||
+
|
||||
+ private final String suggestion;
|
||||
+ private final Component tooltip;
|
||||
+ private final @Nullable Component tooltip;
|
||||
+
|
||||
+ CompletionImpl(final @NotNull String suggestion, final @Nullable Component tooltip) {
|
||||
+ CompletionImpl(final String suggestion, final @Nullable Component tooltip) {
|
||||
+ this.suggestion = suggestion;
|
||||
+ this.tooltip = tooltip;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String suggestion() {
|
||||
+ public String suggestion() {
|
||||
+ return this.suggestion;
|
||||
+ }
|
||||
+
|
||||
|
@ -355,7 +348,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String toString() {
|
||||
+ public String toString() {
|
||||
+ return StringExaminer.simpleEscaping().examine(this);
|
||||
+ }
|
||||
+ }
|
||||
|
|
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockExpEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired anytime the server intends to 'destroy' a block through some triggering reason.
|
||||
|
@ -36,11 +36,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * <p>
|
||||
+ * Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BlockDestroyEvent extends BlockExpEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final BlockData newState;
|
||||
+ private final BlockData newState;
|
||||
+ private boolean willDrop;
|
||||
+ private boolean playEffect = true;
|
||||
+ private BlockData effectBlock;
|
||||
|
@ -48,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, @NotNull BlockData effectBlock, int xp, boolean willDrop) {
|
||||
+ public BlockDestroyEvent(final Block block, final BlockData newState, final BlockData effectBlock, final int xp, final boolean willDrop) {
|
||||
+ super(block, xp);
|
||||
+ this.newState = newState;
|
||||
+ this.effectBlock = effectBlock;
|
||||
|
@ -60,7 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return block break effect
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public BlockData getEffectBlock() {
|
||||
+ return this.effectBlock;
|
||||
+ }
|
||||
|
@ -72,14 +72,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param effectBlock block effect
|
||||
+ */
|
||||
+ public void setEffectBlock(@NotNull BlockData effectBlock) {
|
||||
+ public void setEffectBlock(final BlockData effectBlock) {
|
||||
+ this.effectBlock = effectBlock;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The new state of this block (Air, or a Fluid type)
|
||||
+ */
|
||||
+ public @NotNull BlockData getNewState() {
|
||||
+ public BlockData getNewState() {
|
||||
+ return this.newState.clone();
|
||||
+ }
|
||||
+
|
||||
|
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @param willDrop If the server is going to drop the block in question with this destroy event
|
||||
+ */
|
||||
+ public void setWillDrop(boolean willDrop) {
|
||||
+ public void setWillDrop(final boolean willDrop) {
|
||||
+ this.willDrop = willDrop;
|
||||
+ }
|
||||
+
|
||||
|
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @param playEffect If the server should play the sound effect for this destruction
|
||||
+ */
|
||||
+ public void setPlayEffect(boolean playEffect) {
|
||||
+ public void setPlayEffect(final boolean playEffect) {
|
||||
+ this.playEffect = playEffect;
|
||||
+ }
|
||||
+
|
||||
|
@ -123,17 +123,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * If the event is cancelled, the block will remain in its previous state.
|
||||
+ */
|
||||
+ @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;
|
||||
+ }
|
||||
|
|
|
@ -115,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands.
|
||||
|
@ -138,6 +138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * <p>This is a draft/experimental API and is subject to change.</p>
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public class AsyncPlayerSendCommandsEvent<S extends CommandSourceStack> extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
|
@ -145,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private final boolean hasFiredAsync;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public AsyncPlayerSendCommandsEvent(@NotNull Player player, @NotNull RootCommandNode<S> node, boolean hasFiredAsync) {
|
||||
+ public AsyncPlayerSendCommandsEvent(final Player player, final RootCommandNode<S> node, final boolean hasFiredAsync) {
|
||||
+ super(player, !Bukkit.isPrimaryThread());
|
||||
+ this.node = node;
|
||||
+ this.hasFiredAsync = hasFiredAsync;
|
||||
|
@ -156,8 +157,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the root command node
|
||||
+ */
|
||||
+ public @NotNull RootCommandNode<S> getCommandNode() {
|
||||
+ return node;
|
||||
+ public RootCommandNode<S> getCommandNode() {
|
||||
+ return this.node;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -166,15 +167,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return whether this event has already fired asynchronously
|
||||
+ */
|
||||
+ public boolean hasFiredAsync() {
|
||||
+ return hasFiredAsync;
|
||||
+ return this.hasFiredAsync;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
|
@ -194,13 +193,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+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 sending {@link Suggestions} to the client. Will be called asynchronously if a plugin
|
||||
+ * marks the {@link com.destroystokyo.paper.event.server.AsyncTabCompleteEvent} event handled asynchronously,
|
||||
+ * otherwise called synchronously.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
|
@ -210,7 +210,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private final String buffer;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public AsyncPlayerSendSuggestionsEvent(@NotNull Player player, @NotNull Suggestions suggestions, @NotNull String buffer) {
|
||||
+ public AsyncPlayerSendSuggestionsEvent(final Player player, final Suggestions suggestions, final String buffer) {
|
||||
+ super(player, !Bukkit.isPrimaryThread());
|
||||
+ this.suggestions = suggestions;
|
||||
+ this.buffer = buffer;
|
||||
|
@ -221,8 +221,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the input buffer
|
||||
+ */
|
||||
+ public @NotNull String getBuffer() {
|
||||
+ return buffer;
|
||||
+ public String getBuffer() {
|
||||
+ return this.buffer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -230,8 +230,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the suggestions
|
||||
+ */
|
||||
+ public @NotNull Suggestions getSuggestions() {
|
||||
+ return suggestions;
|
||||
+ public Suggestions getSuggestions() {
|
||||
+ return this.suggestions;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -239,7 +239,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param suggestions suggestions
|
||||
+ */
|
||||
+ public void setSuggestions(@NotNull Suggestions suggestions) {
|
||||
+ public void setSuggestions(final Suggestions suggestions) {
|
||||
+ this.suggestions = suggestions;
|
||||
+ }
|
||||
+
|
||||
|
@ -256,16 +256,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * {@inheritDoc}
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
|
|
|
@ -32,6 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ compileOnlyApi(checkerQual)
|
||||
+ testCompileOnly(checkerQual)
|
||||
+ // Paper end
|
||||
+ api("org.jspecify:jspecify:1.0.0") // Paper - add jspecify
|
||||
+
|
||||
testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
|
|
|
@ -12,30 +12,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import org.bukkit.entity.AreaEffectCloud;
|
||||
+import org.bukkit.entity.DragonFireball;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a DragonFireball collides with a block/entity and spawns an AreaEffectCloud
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EnderDragonFireballHitEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Collection<LivingEntity> targets;
|
||||
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
||||
+ private final Collection<LivingEntity> targets;
|
||||
+ private final AreaEffectCloud areaEffectCloud;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EnderDragonFireballHitEvent(@NotNull DragonFireball fireball, @NotNull Collection<LivingEntity> targets, @NotNull AreaEffectCloud areaEffectCloud) {
|
||||
+ public EnderDragonFireballHitEvent(final DragonFireball fireball, final Collection<LivingEntity> targets, final AreaEffectCloud areaEffectCloud) {
|
||||
+ super(fireball);
|
||||
+ this.targets = targets;
|
||||
+ this.areaEffectCloud = areaEffectCloud;
|
||||
|
@ -44,7 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * The fireball involved in this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public DragonFireball getEntity() {
|
||||
+ return (DragonFireball) super.getEntity();
|
||||
|
@ -55,7 +54,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the targets
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getTargets() {
|
||||
+ return this.targets;
|
||||
+ }
|
||||
|
@ -63,7 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The area effect cloud spawned in this collision
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public AreaEffectCloud getAreaEffectCloud() {
|
||||
+ return this.areaEffectCloud;
|
||||
+ }
|
||||
|
@ -74,17 +71,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;
|
||||
+ }
|
||||
|
@ -103,20 +98,21 @@ 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 an EnderDragon spawns an AreaEffectCloud by shooting flames
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EnderDragonFlameEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final AreaEffectCloud areaEffectCloud;
|
||||
+ private final AreaEffectCloud areaEffectCloud;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EnderDragonFlameEvent(@NotNull EnderDragon enderDragon, @NotNull AreaEffectCloud areaEffectCloud) {
|
||||
+ public EnderDragonFlameEvent(final EnderDragon enderDragon, final AreaEffectCloud areaEffectCloud) {
|
||||
+ super(enderDragon);
|
||||
+ this.areaEffectCloud = areaEffectCloud;
|
||||
+ }
|
||||
|
@ -124,7 +120,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * The enderdragon involved in this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public EnderDragon getEntity() {
|
||||
+ return (EnderDragon) super.getEntity();
|
||||
|
@ -133,7 +128,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The area effect cloud spawned in this collision
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public AreaEffectCloud getAreaEffectCloud() {
|
||||
+ return this.areaEffectCloud;
|
||||
+ }
|
||||
|
@ -144,16 +138,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;
|
||||
+ }
|
||||
|
@ -172,20 +164,21 @@ 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 an EnderDragon shoots a fireball
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EnderDragonShootFireballEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final DragonFireball fireball;
|
||||
+ private final DragonFireball fireball;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EnderDragonShootFireballEvent(@NotNull EnderDragon entity, @NotNull DragonFireball fireball) {
|
||||
+ public EnderDragonShootFireballEvent(final EnderDragon entity, final DragonFireball fireball) {
|
||||
+ super(entity);
|
||||
+ this.fireball = fireball;
|
||||
+ }
|
||||
|
@ -193,7 +186,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * The enderdragon shooting the fireball
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public EnderDragon getEntity() {
|
||||
+ return (EnderDragon) super.getEntity();
|
||||
|
@ -202,7 +194,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The fireball being shot
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DragonFireball getFireball() {
|
||||
+ return this.fireball;
|
||||
+ }
|
||||
|
@ -213,17 +204,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;
|
||||
+ }
|
||||
|
|
|
@ -44,7 +44,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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Enderman determines if it should attack a player or not.
|
||||
|
@ -52,15 +52,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * Starts off cancelled if the player is wearing a pumpkin head or is not looking
|
||||
+ * at the Enderman, according to Vanilla rules.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Player player;
|
||||
+ private final Player player;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EndermanAttackPlayerEvent(@NotNull Enderman entity, @NotNull Player player) {
|
||||
+ public EndermanAttackPlayerEvent(final Enderman entity, final Player player) {
|
||||
+ super(entity);
|
||||
+ this.player = player;
|
||||
+ }
|
||||
|
@ -70,7 +71,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The enderman considering attacking
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Enderman getEntity() {
|
||||
+ return (Enderman) super.getEntity();
|
||||
|
@ -81,7 +81,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The player the Enderman is considering attacking
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
|
@ -100,16 +99,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * Cancels if the Enderman will attack this player
|
||||
+ */
|
||||
+ @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;
|
||||
+ }
|
||||
|
|
|
@ -20,22 +20,22 @@ 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;
|
||||
+
|
||||
+@NullMarked
|
||||
+public class EndermanEscapeEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Reason reason;
|
||||
+ private final Reason reason;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EndermanEscapeEvent(@NotNull Enderman entity, @NotNull Reason reason) {
|
||||
+ public EndermanEscapeEvent(final Enderman entity, final Reason reason) {
|
||||
+ super(entity);
|
||||
+ this.reason = reason;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Enderman getEntity() {
|
||||
+ return (Enderman) super.getEntity();
|
||||
|
@ -44,7 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The reason the enderman is trying to escape
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Reason getReason() {
|
||||
+ return this.reason;
|
||||
+ }
|
||||
|
@ -57,21 +56,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * Cancels the escape.
|
||||
+ * <p>
|
||||
+ * If this escape normally would of resulted in damage avoidance such as indirect,
|
||||
+ * If this escape normally had resulted in damage avoidance such as indirect,
|
||||
+ * the enderman will now take damage.
|
||||
+ */
|
||||
+ @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;
|
||||
+ }
|
||||
|
|
|
@ -18,21 +18,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity is being added to the world for any reason (including a chunk loading).
|
||||
+ * <p>
|
||||
+ * Not to be confused with {@link CreatureSpawnEvent}
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityAddToWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final World world;
|
||||
+ private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityAddToWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
||||
+ public EntityAddToWorldEvent(final Entity entity, final World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
+ }
|
||||
|
@ -40,17 +41,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The world that the entity is being added to
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public World getWorld() {
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
@ -68,20 +66,21 @@ 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 any time an entity is being removed from a world for any reason (including a chunk unloading).
|
||||
+ * Note: The entity is updated prior to this event being called, as such, the entity's world may not be equal to {@link #getWorld()}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityRemoveFromWorldEvent extends EntityEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final World world;
|
||||
+ private final World world;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityRemoveFromWorldEvent(@NotNull Entity entity, @NotNull World world) {
|
||||
+ public EntityRemoveFromWorldEvent(final Entity entity, final World world) {
|
||||
+ super(entity);
|
||||
+ this.world = world;
|
||||
+ }
|
||||
|
@ -89,17 +88,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The world that the entity is being removed from
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public World getWorld() {
|
||||
+ return this.world;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -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 an entity jumps
|
||||
+ * <p>
|
||||
+ * Cancelling the event will stop the entity from jumping
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityJumpEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -31,11 +32,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityJumpEvent(@NotNull LivingEntity entity) {
|
||||
+ public EntityJumpEvent(final LivingEntity entity) {
|
||||
+ super(entity);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
|
@ -45,17 +45,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;
|
||||
+ }
|
||||
|
|
|
@ -20,13 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.event.player.PlayerMoveEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Holds information for living entity movement events
|
||||
+ * <p>
|
||||
+ * Does not fire for players; use {@link PlayerMoveEvent} for player movement.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityMoveEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -37,14 +38,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityMoveEvent(@NotNull LivingEntity entity, @NotNull Location from, @NotNull Location to) {
|
||||
+ public EntityMoveEvent(final LivingEntity entity, final Location from, final Location to) {
|
||||
+ super(entity);
|
||||
+ this.from = from;
|
||||
+ this.to = to;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
|
@ -54,7 +54,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Location the entity moved from
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getFrom() {
|
||||
+ return this.from;
|
||||
+ }
|
||||
|
@ -64,8 +63,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param from New location to mark as the entity's previous location
|
||||
+ */
|
||||
+ public void setFrom(@NotNull Location from) {
|
||||
+ validateLocation(from);
|
||||
+ public void setFrom(final Location from) {
|
||||
+ this.validateLocation(from);
|
||||
+ this.from = from;
|
||||
+ }
|
||||
+
|
||||
|
@ -74,7 +73,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Location the entity moved to
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getTo() {
|
||||
+ return this.to;
|
||||
+ }
|
||||
|
@ -84,8 +82,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param to New Location this entity will move to
|
||||
+ */
|
||||
+ public void setTo(@NotNull Location to) {
|
||||
+ validateLocation(to);
|
||||
+ public void setTo(final Location to) {
|
||||
+ this.validateLocation(to);
|
||||
+ this.to = to;
|
||||
+ }
|
||||
+
|
||||
|
@ -95,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return whether the entity has changed position or not
|
||||
+ */
|
||||
+ public boolean hasChangedPosition() {
|
||||
+ return hasExplicitlyChangedPosition() || !this.from.getWorld().equals(this.to.getWorld());
|
||||
+ return this.hasExplicitlyChangedPosition() || !this.from.getWorld().equals(this.to.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -113,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return whether the entity has moved to a new block or not
|
||||
+ */
|
||||
+ public boolean hasChangedBlock() {
|
||||
+ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld());
|
||||
+ return this.hasExplicitlyChangedBlock() || !this.from.getWorld().equals(this.to.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -134,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.from.getPitch() != this.to.getPitch() || this.from.getYaw() != this.to.getYaw();
|
||||
+ }
|
||||
+
|
||||
+ private void validateLocation(@NotNull Location loc) {
|
||||
+ private void validateLocation(final Location loc) {
|
||||
+ Preconditions.checkArgument(loc != null, "Cannot use null location!");
|
||||
+ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!");
|
||||
+ }
|
||||
|
@ -145,17 +143,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -19,8 +19,8 @@ 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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity decides to start moving towards a location.
|
||||
|
@ -28,16 +28,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * This event does not fire for the entities actual movement. Only when it
|
||||
+ * is choosing to start moving to a location.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityPathfindEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @Nullable private final Entity targetEntity;
|
||||
+ @NotNull private final Location location;
|
||||
+ private final @Nullable Entity targetEntity;
|
||||
+ private final Location location;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPathfindEvent(@NotNull Entity entity, @NotNull Location location, @Nullable Entity targetEntity) {
|
||||
+ public EntityPathfindEvent(final Entity entity, final Location location, final @Nullable Entity targetEntity) {
|
||||
+ super(entity);
|
||||
+ this.targetEntity = targetEntity;
|
||||
+ this.location = location;
|
||||
|
@ -48,7 +49,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The Entity that is pathfinding.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getEntity() {
|
||||
+ return this.entity;
|
||||
+ }
|
||||
|
@ -56,12 +56,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * If the Entity is trying to pathfind to an entity, this is the entity in relation.
|
||||
+ * <br>
|
||||
+ * Otherwise this will return {@code null}.
|
||||
+ * Otherwise, this will return {@code null}.
|
||||
+ *
|
||||
+ * @return The entity target or {@code null}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getTargetEntity() {
|
||||
+ public @Nullable Entity getTargetEntity() {
|
||||
+ return this.targetEntity;
|
||||
+ }
|
||||
+
|
||||
|
@ -72,7 +71,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Location of where the entity is trying to pathfind to.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLoc() {
|
||||
+ return this.location.clone();
|
||||
+ }
|
||||
|
@ -83,17 +81,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;
|
||||
+ }
|
||||
|
|
|
@ -46,22 +46,23 @@ 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 anytime the server is about to merge 2 experience orbs into one
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class ExperienceOrbMergeEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ExperienceOrb mergeTarget;
|
||||
+ @NotNull private final ExperienceOrb mergeSource;
|
||||
+ private final ExperienceOrb mergeTarget;
|
||||
+ private final ExperienceOrb mergeSource;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ExperienceOrbMergeEvent(@NotNull ExperienceOrb mergeTarget, @NotNull ExperienceOrb mergeSource) {
|
||||
+ public ExperienceOrbMergeEvent(final ExperienceOrb mergeTarget, final ExperienceOrb mergeSource) {
|
||||
+ super(mergeTarget);
|
||||
+ this.mergeTarget = mergeTarget;
|
||||
+ this.mergeSource = mergeSource;
|
||||
|
@ -70,7 +71,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The orb that will absorb the other experience orb
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ExperienceOrb getMergeTarget() {
|
||||
+ return this.mergeTarget;
|
||||
+ }
|
||||
|
@ -78,7 +78,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The orb that is subject to being removed and merged into the target orb
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ExperienceOrb getMergeSource() {
|
||||
+ return this.mergeSource;
|
||||
+ }
|
||||
|
@ -92,17 +91,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @param cancel {@code true} if you wish to cancel this event, and prevent the orbs from merging
|
||||
+ */
|
||||
+ @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;
|
||||
+ }
|
||||
|
|
|
@ -17,18 +17,19 @@ 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.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon is activated.
|
||||
+ * Activation occurs when the beacon beam becomes visible.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BeaconActivatedEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconActivatedEvent(@NotNull Block block) {
|
||||
+ public BeaconActivatedEvent(final Block block) {
|
||||
+ super(block);
|
||||
+ }
|
||||
+
|
||||
|
@ -37,18 +38,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the beacon that was activated.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Beacon getBeacon() {
|
||||
+ return (Beacon) this.block.getState();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
@ -67,18 +65,19 @@ 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.Nullable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon is deactivated, either because its base block(s) or itself were destroyed.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BeaconDeactivatedEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconDeactivatedEvent(@NotNull Block block) {
|
||||
+ public BeaconDeactivatedEvent(final Block block) {
|
||||
+ super(block);
|
||||
+ }
|
||||
+
|
||||
|
@ -89,18 +88,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The beacon that got deactivated, or {@code null} if it does not exist.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Beacon getBeacon() {
|
||||
+ public @Nullable Beacon getBeacon() {
|
||||
+ return this.block.getType() == Material.BEACON ? (Beacon) this.block.getState() : null;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -21,11 +21,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when the server is calculating what chunks to try to spawn monsters in every Monster Spawn Tick event
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerNaturallySpawnCreaturesEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -34,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerNaturallySpawnCreaturesEvent(@NotNull Player player, byte radius) {
|
||||
+ public PlayerNaturallySpawnCreaturesEvent(final Player player, final byte radius) {
|
||||
+ super(player);
|
||||
+ this.radius = radius;
|
||||
+ }
|
||||
|
@ -49,12 +50,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @param radius The radius of chunks around this player to be included in natural spawn selection
|
||||
+ */
|
||||
+ public void setSpawnRadius(byte radius) {
|
||||
+ public void setSpawnRadius(final byte radius) {
|
||||
+ this.radius = radius;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return If this players chunks will be excluded from natural spawns
|
||||
+ * @return If this player's chunks will be excluded from natural spawns
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
|
@ -62,20 +63,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param cancel {@code true} if you wish to cancel this event, and not include this players chunks for natural spawning
|
||||
+ * @param cancel {@code true} if you wish to cancel this event, and not include this player's chunks for natural spawning
|
||||
+ */
|
||||
+ @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;
|
||||
+ }
|
||||
|
|
|
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * WARNING: This event only fires for a limited number of cases, and not for every case that {@link CreatureSpawnEvent} does.
|
||||
|
@ -41,19 +41,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * Currently: NATURAL and SPAWNER based reasons. <!-- Please submit a Pull Request for future additions. -->
|
||||
+ * Also, Plugins that replace Entity Registrations with their own custom entities might not fire this event.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PreCreatureSpawnEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Location location;
|
||||
+ @NotNull private final EntityType type;
|
||||
+ @NotNull private final CreatureSpawnEvent.SpawnReason reason;
|
||||
+ private final Location location;
|
||||
+ private final EntityType type;
|
||||
+ private final CreatureSpawnEvent.SpawnReason reason;
|
||||
+ private boolean shouldAbortSpawn;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ public PreCreatureSpawnEvent(final Location location, final EntityType type, final CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ this.location = location;
|
||||
+ this.type = type;
|
||||
+ this.reason = reason;
|
||||
|
@ -62,7 +63,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The location this creature is being spawned at
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getSpawnLocation() {
|
||||
+ return this.location.clone();
|
||||
+ }
|
||||
|
@ -70,7 +70,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The type of creature being spawned
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EntityType getType() {
|
||||
+ return this.type;
|
||||
+ }
|
||||
|
@ -78,7 +77,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return Reason this creature is spawning (ie, NATURAL vs SPAWNER)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CreatureSpawnEvent.SpawnReason getReason() {
|
||||
+ return this.reason;
|
||||
+ }
|
||||
|
@ -96,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param shouldAbortSpawn Set if the spawn process should be aborted vs trying more attempts
|
||||
+ */
|
||||
+ public void setShouldAbortSpawn(boolean shouldAbortSpawn) {
|
||||
+ public void setShouldAbortSpawn(final boolean shouldAbortSpawn) {
|
||||
+ this.shouldAbortSpawn = shouldAbortSpawn;
|
||||
+ }
|
||||
+
|
||||
|
@ -114,17 +112,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @param cancel {@code true} if you wish to cancel this event, and abort the spawn of this creature
|
||||
+ */
|
||||
+ @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;
|
||||
+ }
|
||||
|
|
|
@ -22,7 +22,7 @@ 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 before an entity is spawned into a world by a spawner.
|
||||
|
@ -30,17 +30,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * This only includes the spawner's location and not the full BlockState snapshot for performance reasons.
|
||||
+ * If you really need it you have to get the spawner yourself.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent {
|
||||
+
|
||||
+ @NotNull private final Location spawnerLocation;
|
||||
+ private final Location spawnerLocation;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) {
|
||||
+ public PreSpawnerSpawnEvent(final Location location, final EntityType type, final Location spawnerLocation) {
|
||||
+ super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER);
|
||||
+ this.spawnerLocation = spawnerLocation;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Location getSpawnerLocation() {
|
||||
+ return this.spawnerLocation.clone();
|
||||
+ }
|
||||
|
|
|
@ -18,9 +18,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.Bukkit;
|
||||
+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;
|
||||
+
|
||||
+/**
|
||||
+ * Allows a plugin to be notified anytime AFTER a Profile has been looked up from the Mojang API
|
||||
|
@ -29,14 +28,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * No guarantees are made about thread execution context for this event. If you need to know, check
|
||||
+ * {@link Event#isAsynchronous()}
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class LookupProfileEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final PlayerProfile profile;
|
||||
+ private final PlayerProfile profile;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public LookupProfileEvent(@NotNull PlayerProfile profile) {
|
||||
+ public LookupProfileEvent(final PlayerProfile profile) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.profile = profile;
|
||||
+ }
|
||||
|
@ -44,18 +44,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The profile that was recently looked up. This profile can be mutated
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return this.profile;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
@ -69,16 +66,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+package com.destroystokyo.paper.event.profile;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.ProfileProperty;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+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;
|
||||
+
|
||||
+/**
|
||||
+ * Allows a plugin to intercept a Profile Lookup for a Profile by name
|
||||
|
@ -90,17 +86,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * No guarantees are made about thread execution context for this event. If you need to know, check
|
||||
+ * {@link Event#isAsynchronous()}
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PreLookupProfileEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final String name;
|
||||
+ private final String name;
|
||||
+
|
||||
+ private UUID uuid;
|
||||
+ @NotNull private Set<ProfileProperty> properties = new HashSet<>();
|
||||
+ private @Nullable UUID uuid;
|
||||
+ private Set<ProfileProperty> properties = new HashSet<>();
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PreLookupProfileEvent(@NotNull String name) {
|
||||
+ public PreLookupProfileEvent(final String name) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.name = name;
|
||||
+ }
|
||||
|
@ -108,7 +105,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return Name of the profile
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getName() {
|
||||
+ return this.name;
|
||||
+ }
|
||||
|
@ -120,8 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The UUID of the profile if it has already been provided by a plugin
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public UUID getUUID() {
|
||||
+ public @Nullable UUID getUUID() {
|
||||
+ return this.uuid;
|
||||
+ }
|
||||
+
|
||||
|
@ -132,7 +127,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param uuid the UUID to set for the profile or {@code null} to reset
|
||||
+ */
|
||||
+ public void setUUID(@Nullable UUID uuid) {
|
||||
+ public void setUUID(final @Nullable UUID uuid) {
|
||||
+ this.uuid = uuid;
|
||||
+ }
|
||||
+
|
||||
|
@ -140,7 +135,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * @return The currently pending pre-populated properties.
|
||||
+ * Any property in this Set will be automatically prefilled on this Profile
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Set<ProfileProperty> getProfileProperties() {
|
||||
+ return this.properties;
|
||||
+ }
|
||||
|
@ -151,7 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param properties The properties to add
|
||||
+ */
|
||||
+ public void setProfileProperties(@NotNull Set<ProfileProperty> properties) {
|
||||
+ public void setProfileProperties(final Set<ProfileProperty> properties) {
|
||||
+ this.properties = new HashSet<>();
|
||||
+ this.properties.addAll(properties);
|
||||
+ }
|
||||
|
@ -162,17 +156,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param properties The properties to add
|
||||
+ */
|
||||
+ public void addProfileProperties(@NotNull Set<ProfileProperty> properties) {
|
||||
+ public void addProfileProperties(final Set<ProfileProperty> properties) {
|
||||
+ this.properties.addAll(properties);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -16,11 +16,12 @@ 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 the server has finished ticking the main loop
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class ServerTickEndEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -30,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private final long timeEnd;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerTickEndEvent(int tickNumber, double tickDuration, long timeRemaining) {
|
||||
+ public ServerTickEndEvent(final int tickNumber, final double tickDuration, final long timeRemaining) {
|
||||
+ this.tickNumber = tickNumber;
|
||||
+ this.tickDuration = tickDuration;
|
||||
+ this.timeEnd = System.nanoTime() + timeRemaining;
|
||||
|
@ -63,12 +64,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.timeEnd - System.nanoTime();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
@ -84,8 +83,9 @@ 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;
|
||||
+
|
||||
+@NullMarked
|
||||
+public class ServerTickStartEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private final int tickNumber;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerTickStartEvent(int tickNumber) {
|
||||
+ public ServerTickStartEvent(final int tickNumber) {
|
||||
+ this.tickNumber = tickNumber;
|
||||
+ }
|
||||
+
|
||||
|
@ -104,12 +104,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.tickNumber;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
|
@ -13,19 +13,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import java.util.List;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+import org.bukkit.entity.SkeletonHorse;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Event called when a player gets close to a skeleton horse and triggers the lightning trap
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -35,23 +35,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Deprecated
|
||||
+ @ApiStatus.Internal
|
||||
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse) {
|
||||
+ public SkeletonHorseTrapEvent(final SkeletonHorse horse) {
|
||||
+ this(horse, ImmutableList.of());
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse, @NotNull List<HumanEntity> eligibleHumans) {
|
||||
+ public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) {
|
||||
+ super(horse);
|
||||
+ this.eligibleHumans = eligibleHumans;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public SkeletonHorse getEntity() {
|
||||
+ return (SkeletonHorse) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public List<HumanEntity> getEligibleHumans() {
|
||||
+ return this.eligibleHumans;
|
||||
+ }
|
||||
|
@ -62,17 +60,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;
|
||||
+ }
|
||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to change its facing direction.
|
||||
|
@ -22,12 +22,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to change direction.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class SlimeChangeDirectionEvent extends SlimePathfindEvent {
|
||||
+
|
||||
+ private float yaw;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeChangeDirectionEvent(@NotNull Slime slime, float yaw) {
|
||||
+ public SlimeChangeDirectionEvent(final Slime slime, final float yaw) {
|
||||
+ super(slime);
|
||||
+ this.yaw = yaw;
|
||||
+ }
|
||||
|
@ -46,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param yaw Chosen yaw
|
||||
+ */
|
||||
+ public void setNewYaw(float yaw) {
|
||||
+ public void setNewYaw(final float yaw) {
|
||||
+ this.yaw = yaw;
|
||||
+ }
|
||||
+}
|
||||
|
@ -63,7 +64,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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to start pathfinding.
|
||||
|
@ -71,6 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start moving.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class SlimePathfindEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -78,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimePathfindEvent(@NotNull Slime slime) {
|
||||
+ public SlimePathfindEvent(final Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
+
|
||||
|
@ -87,7 +89,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The Slime that is pathfinding.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Slime getEntity() {
|
||||
+ return (Slime) super.getEntity();
|
||||
+ }
|
||||
|
@ -98,16 +99,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;
|
||||
+ }
|
||||
|
@ -122,7 +121,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to start jumping while swimming in water/lava.
|
||||
|
@ -130,10 +129,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start jumping.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class SlimeSwimEvent extends SlimeWanderEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeSwimEvent(@NotNull Slime slime) {
|
||||
+ public SlimeSwimEvent(final Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
+}
|
||||
|
@ -148,7 +148,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to change direction to target a LivingEntity.
|
||||
|
@ -156,12 +156,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start moving.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class SlimeTargetLivingEntityEvent extends SlimePathfindEvent {
|
||||
+
|
||||
+ @NotNull private final LivingEntity target;
|
||||
+ private final LivingEntity target;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeTargetLivingEntityEvent(@NotNull Slime slime, @NotNull LivingEntity target) {
|
||||
+ public SlimeTargetLivingEntityEvent(final Slime slime, final LivingEntity target) {
|
||||
+ super(slime);
|
||||
+ this.target = target;
|
||||
+ }
|
||||
|
@ -171,7 +172,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Targeted entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LivingEntity getTarget() {
|
||||
+ return this.target;
|
||||
+ }
|
||||
|
@ -186,7 +186,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to start wandering.
|
||||
|
@ -194,10 +194,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start moving.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class SlimeWanderEvent extends SlimePathfindEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public SlimeWanderEvent(@NotNull Slime slime) {
|
||||
+ public SlimeWanderEvent(final Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -104,6 +104,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Test
|
||||
@@ -0,0 +0,0 @@ public class AnnotationTest {
|
||||
continue;
|
||||
}
|
||||
|
||||
+ // Paper start - skip class if it's @NullMarked
|
||||
+ if (isClassNullMarked(clazz)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - skip class if it's @NullMarked
|
||||
+
|
||||
for (MethodNode method : clazz.methods) {
|
||||
if (!isMethodIncluded(clazz, method, foundClasses)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mustBeAnnotated(Type.getReturnType(method.desc)) && !isWellAnnotated(method.invisibleAnnotations)) {
|
||||
|
@ -175,6 +187,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
|
||||
@@ -0,0 +0,0 @@ public class AnnotationTest {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - skip class if it's @NullMarked
|
||||
+ private static boolean isClassNullMarked(@NotNull ClassNode clazz) {
|
||||
+ return clazz.visibleAnnotations != null && clazz.visibleAnnotations.stream().anyMatch(node -> "Lorg/jspecify/annotations/NullMarked;".equals(node.desc));
|
||||
+ }
|
||||
+ // Paper end - skip class if it's @NullMarked
|
||||
+
|
||||
private static boolean isClassIncluded(@NotNull ClassNode clazz, @NotNull Map<String, ClassNode> allClasses) {
|
||||
// Exclude private, synthetic or deprecated classes and annotations, since their members can't be null
|
||||
if ((clazz.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED | Opcodes.ACC_ANNOTATION)) != 0) {
|
||||
@@ -0,0 +0,0 @@ public class AnnotationTest {
|
||||
// Exceptions are excluded
|
||||
return false;
|
||||
|
|
|
@ -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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Turtle decides to go home
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class TurtleGoHomeEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -29,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TurtleGoHomeEvent(@NotNull Turtle turtle) {
|
||||
+ public TurtleGoHomeEvent(final Turtle turtle) {
|
||||
+ super(turtle);
|
||||
+ }
|
||||
+
|
||||
|
@ -38,7 +39,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The turtle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) super.getEntity();
|
||||
+ }
|
||||
|
@ -49,16 +49,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;
|
||||
+ }
|
||||
|
@ -77,23 +75,23 @@ 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 Turtle lays eggs
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class TurtleLayEggEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ private final Location location;
|
||||
+ private int eggCount;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) {
|
||||
+ public TurtleLayEggEvent(final Turtle turtle, final Location location, final int eggCount) {
|
||||
+ super(turtle);
|
||||
+ this.location = location;
|
||||
+ this.eggCount = eggCount;
|
||||
|
@ -104,7 +102,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The turtle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) super.getEntity();
|
||||
+ }
|
||||
|
@ -114,7 +111,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Location of eggs
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLocation() {
|
||||
+ return this.location.clone();
|
||||
+ }
|
||||
|
@ -133,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param eggCount Number of eggs
|
||||
+ */
|
||||
+ public void setEggCount(int eggCount) {
|
||||
+ public void setEggCount(final int eggCount) {
|
||||
+ if (eggCount < 1) {
|
||||
+ this.cancelled = true;
|
||||
+ return;
|
||||
|
@ -147,16 +143,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;
|
||||
+ }
|
||||
|
@ -175,20 +169,21 @@ 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 Turtle starts digging to lay eggs
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Location location;
|
||||
+ private final Location location;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) {
|
||||
+ public TurtleStartDiggingEvent(final Turtle turtle, final Location location) {
|
||||
+ super(turtle);
|
||||
+ this.location = location;
|
||||
+ }
|
||||
|
@ -198,7 +193,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return The turtle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) super.getEntity();
|
||||
+ }
|
||||
|
@ -208,7 +202,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return Location where digging
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLocation() {
|
||||
+ return this.location.clone();
|
||||
+ }
|
||||
|
@ -219,16 +212,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;
|
||||
+ }
|
||||
|
|
|
@ -19,26 +19,26 @@ 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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a witch consumes the potion in their hand to buff themselves.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class WitchConsumePotionEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @Nullable private ItemStack potion;
|
||||
+ private @Nullable ItemStack potion;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WitchConsumePotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
|
||||
+ public WitchConsumePotionEvent(final Witch witch, final @Nullable ItemStack potion) {
|
||||
+ super(witch);
|
||||
+ this.potion = potion;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Witch getEntity() {
|
||||
+ return (Witch) super.getEntity();
|
||||
|
@ -47,8 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return the potion the witch will consume and have the effects applied.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getPotion() {
|
||||
+ public @Nullable ItemStack getPotion() {
|
||||
+ return this.potion;
|
||||
+ }
|
||||
+
|
||||
|
@ -57,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param potion The potion
|
||||
+ */
|
||||
+ public void setPotion(@Nullable ItemStack potion) {
|
||||
+ public void setPotion(final @Nullable ItemStack potion) {
|
||||
+ this.potion = potion != null ? potion.clone() : null;
|
||||
+ }
|
||||
+
|
||||
|
@ -70,16 +69,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;
|
||||
+ }
|
||||
|
|
|
@ -19,23 +19,23 @@ 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;
|
||||
+
|
||||
+@NullMarked
|
||||
+public class WitchReadyPotionEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private ItemStack potion;
|
||||
+ private @Nullable ItemStack potion;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WitchReadyPotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
|
||||
+ public WitchReadyPotionEvent(final Witch witch, final @Nullable ItemStack potion) {
|
||||
+ super(witch);
|
||||
+ this.potion = potion;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Witch getEntity() {
|
||||
+ return (Witch) super.getEntity();
|
||||
|
@ -44,8 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return the potion the witch is readying to use
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getPotion() {
|
||||
+ public @Nullable ItemStack getPotion() {
|
||||
+ return this.potion;
|
||||
+ }
|
||||
+
|
||||
|
@ -54,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param potion The potion
|
||||
+ */
|
||||
+ public void setPotion(@Nullable ItemStack potion) {
|
||||
+ public void setPotion(final @Nullable ItemStack potion) {
|
||||
+ this.potion = potion != null ? potion.clone() : null;
|
||||
+ }
|
||||
+
|
||||
|
@ -64,17 +63,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;
|
||||
+ }
|
||||
|
|
|
@ -20,28 +20,28 @@ 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;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a witch throws a potion at a player
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class WitchThrowPotionEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final LivingEntity target;
|
||||
+ @Nullable private ItemStack potion;
|
||||
+ private final LivingEntity target;
|
||||
+ private @Nullable ItemStack potion;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public WitchThrowPotionEvent(@NotNull Witch witch, @NotNull LivingEntity target, @Nullable ItemStack potion) {
|
||||
+ public WitchThrowPotionEvent(final Witch witch, final LivingEntity target, final @Nullable ItemStack potion) {
|
||||
+ super(witch);
|
||||
+ this.target = target;
|
||||
+ this.potion = potion;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Witch getEntity() {
|
||||
+ return (Witch) super.getEntity();
|
||||
|
@ -50,7 +50,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The target of the potion
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LivingEntity getTarget() {
|
||||
+ return this.target;
|
||||
+ }
|
||||
|
@ -58,8 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /**
|
||||
+ * @return The potion the witch will throw at a player
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getPotion() {
|
||||
+ public @Nullable ItemStack getPotion() {
|
||||
+ return this.potion;
|
||||
+ }
|
||||
+
|
||||
|
@ -68,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @param potion The potion
|
||||
+ */
|
||||
+ public void setPotion(@Nullable ItemStack potion) {
|
||||
+ public void setPotion(final @Nullable ItemStack potion) {
|
||||
+ this.potion = potion != null ? potion.clone() : null;
|
||||
+ }
|
||||
+
|
||||
|
@ -81,17 +79,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;
|
||||
+ }
|
||||
|
|
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockFormEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the {@link EnderDragon} is defeated (killed) in a {@link DragonBattle},
|
||||
|
@ -30,6 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * <b>This event might be cancelled by default depending on
|
||||
+ * e.g. {@link DragonBattle#hasBeenPreviouslyKilled()} and server configuration.</b>
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class DragonEggFormEvent extends BlockFormEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
@ -37,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private final DragonBattle dragonBattle;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public DragonEggFormEvent(@NotNull Block block, @NotNull BlockState newState, @NotNull DragonBattle dragonBattle) {
|
||||
+ public DragonEggFormEvent(final Block block, final BlockState newState, final DragonBattle dragonBattle) {
|
||||
+ super(block, newState);
|
||||
+ this.dragonBattle = dragonBattle;
|
||||
+ }
|
||||
|
@ -49,18 +50,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ *
|
||||
+ * @return the dragon battle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DragonBattle getDragonBattle() {
|
||||
+ return this.dragonBattle;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue