SPIGOT-2540: Add nullability annotations to entire Bukkit API
By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block is broken by a player.
|
||||
@@ -30,7 +31,7 @@ public class BlockBreakEvent extends BlockExpEvent implements Cancellable {
|
||||
private boolean dropItems;
|
||||
private boolean cancel;
|
||||
|
||||
public BlockBreakEvent(final Block theBlock, final Player player) {
|
||||
public BlockBreakEvent(@NotNull final Block theBlock, @NotNull final Player player) {
|
||||
super(theBlock, 0);
|
||||
|
||||
this.player = player;
|
||||
@@ -42,6 +43,7 @@ public class BlockBreakEvent extends BlockExpEvent implements Cancellable {
|
||||
*
|
||||
* @return The Player that is breaking the block involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a block is destroyed as a result of being burnt by fire.
|
||||
@@ -16,11 +18,11 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
||||
private final Block ignitingBlock;
|
||||
|
||||
@Deprecated
|
||||
public BlockBurnEvent(final Block block) {
|
||||
public BlockBurnEvent(@NotNull final Block block) {
|
||||
this(block, null);
|
||||
}
|
||||
|
||||
public BlockBurnEvent(final Block block, final Block ignitingBlock) {
|
||||
public BlockBurnEvent(@NotNull final Block block, @Nullable final Block ignitingBlock) {
|
||||
super(block);
|
||||
this.ignitingBlock = ignitingBlock;
|
||||
}
|
||||
@@ -31,6 +33,7 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
||||
* @return The Block that ignited and burned this block, or null if no
|
||||
* source block exists
|
||||
*/
|
||||
@Nullable
|
||||
public Block getIgnitingBlock() {
|
||||
return ignitingBlock;
|
||||
}
|
||||
@@ -43,11 +46,13 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when we try to place a block, to see if we can build it here or not.
|
||||
@@ -25,7 +27,7 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
private final Player player;
|
||||
|
||||
@Deprecated
|
||||
public BlockCanBuildEvent(final Block block, final BlockData type, final boolean canBuild) {
|
||||
public BlockCanBuildEvent(@NotNull final Block block, @NotNull final BlockData type, final boolean canBuild) {
|
||||
this(block, null, type, canBuild);
|
||||
}
|
||||
|
||||
@@ -36,7 +38,7 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
* @param type the id of the block to place
|
||||
* @param canBuild whether we can build
|
||||
*/
|
||||
public BlockCanBuildEvent(final Block block, final Player player, final BlockData type, final boolean canBuild) {
|
||||
public BlockCanBuildEvent(@NotNull final Block block, @Nullable final Player player, @NotNull final BlockData type, final boolean canBuild) {
|
||||
super(block);
|
||||
this.player = player;
|
||||
this.buildable = canBuild;
|
||||
@@ -70,6 +72,7 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
*
|
||||
* @return The Material that we are trying to place
|
||||
*/
|
||||
@NotNull
|
||||
public Material getMaterial() {
|
||||
return blockData.getMaterial();
|
||||
}
|
||||
@@ -79,6 +82,7 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
*
|
||||
* @return The BlockData that we are trying to place
|
||||
*/
|
||||
@NotNull
|
||||
public BlockData getBlockData() {
|
||||
return blockData;
|
||||
}
|
||||
@@ -90,15 +94,18 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
*
|
||||
* @return The Player who placed the block involved in this event
|
||||
*/
|
||||
@Nullable
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block is damaged by a player.
|
||||
@@ -18,7 +19,7 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancel;
|
||||
private final ItemStack itemstack;
|
||||
|
||||
public BlockDamageEvent(final Player player, final Block block, final ItemStack itemInHand, final boolean instaBreak) {
|
||||
public BlockDamageEvent(@NotNull final Player player, @NotNull final Block block, @NotNull final ItemStack itemInHand, final boolean instaBreak) {
|
||||
super(block);
|
||||
this.instaBreak = instaBreak;
|
||||
this.player = player;
|
||||
@@ -31,6 +32,7 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The player damaging the block involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
@@ -60,6 +62,7 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The ItemStack for the item currently in the player's hand
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemstack;
|
||||
}
|
||||
@@ -72,11 +75,13 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when an equippable item is dispensed from a block and equipped on a
|
||||
@@ -16,7 +17,7 @@ public class BlockDispenseArmorEvent extends BlockDispenseEvent {
|
||||
|
||||
private final LivingEntity target;
|
||||
|
||||
public BlockDispenseArmorEvent(Block block, ItemStack dispensed, LivingEntity target) {
|
||||
public BlockDispenseArmorEvent(@NotNull Block block, @NotNull ItemStack dispensed, @NotNull LivingEntity target) {
|
||||
super(block, dispensed, new Vector(0, 0, 0));
|
||||
this.target = target;
|
||||
}
|
||||
@@ -26,6 +27,7 @@ public class BlockDispenseArmorEvent extends BlockDispenseEvent {
|
||||
*
|
||||
* @return the target entity
|
||||
*/
|
||||
@NotNull
|
||||
public LivingEntity getTargetEntity() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when an item is dispensed from a block.
|
||||
@@ -18,7 +19,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
private ItemStack item;
|
||||
private Vector velocity;
|
||||
|
||||
public BlockDispenseEvent(final Block block, final ItemStack dispensed, final Vector velocity) {
|
||||
public BlockDispenseEvent(@NotNull final Block block, @NotNull final ItemStack dispensed, @NotNull final Vector velocity) {
|
||||
super(block);
|
||||
this.item = dispensed;
|
||||
this.velocity = velocity;
|
||||
@@ -31,6 +32,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return An ItemStack for the item being dispensed
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItem() {
|
||||
return item.clone();
|
||||
}
|
||||
@@ -40,7 +42,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @param item the item being dispensed
|
||||
*/
|
||||
public void setItem(ItemStack item) {
|
||||
public void setItem(@NotNull ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@@ -52,6 +54,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return A Vector for the dispensed item's velocity
|
||||
*/
|
||||
@NotNull
|
||||
public Vector getVelocity() {
|
||||
return velocity.clone();
|
||||
}
|
||||
@@ -61,7 +64,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @param vel the velocity of the item being dispensed
|
||||
*/
|
||||
public void setVelocity(Vector vel) {
|
||||
public void setVelocity(@NotNull Vector vel) {
|
||||
velocity = vel;
|
||||
}
|
||||
|
||||
@@ -73,11 +76,13 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called if a block broken by a player drops an item.
|
||||
@@ -36,7 +37,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable {
|
||||
private final BlockState blockState;
|
||||
private final List<Item> items;
|
||||
|
||||
public BlockDropItemEvent(Block block, BlockState blockState, Player player, List<Item> items) {
|
||||
public BlockDropItemEvent(@NotNull Block block, @NotNull BlockState blockState, @NotNull Player player, @NotNull List<Item> items) {
|
||||
super(block);
|
||||
this.blockState = blockState;
|
||||
this.player = player;
|
||||
@@ -48,6 +49,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The Player that is breaking the block involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
@@ -58,6 +60,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The BlockState of the block involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public BlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
@@ -70,6 +73,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The Item the block caused to drop
|
||||
*/
|
||||
@NotNull
|
||||
public List<Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
@@ -78,6 +82,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable {
|
||||
* @deprecated very temporary compatibility measure
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public Item getItem() {
|
||||
return items.get(0);
|
||||
}
|
||||
@@ -92,11 +97,13 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Event;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a block related event.
|
||||
@@ -9,7 +10,7 @@ import org.bukkit.event.Event;
|
||||
public abstract class BlockEvent extends Event {
|
||||
protected Block block;
|
||||
|
||||
public BlockEvent(final Block theBlock) {
|
||||
public BlockEvent(@NotNull final Block theBlock) {
|
||||
block = theBlock;
|
||||
}
|
||||
|
||||
@@ -18,6 +19,7 @@ public abstract class BlockEvent extends Event {
|
||||
*
|
||||
* @return The Block which block is involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public final Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An event that's called when a block yields experience.
|
||||
@@ -10,7 +11,7 @@ public class BlockExpEvent extends BlockEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int exp;
|
||||
|
||||
public BlockExpEvent(Block block, int exp) {
|
||||
public BlockExpEvent(@NotNull Block block, int exp) {
|
||||
super(block);
|
||||
|
||||
this.exp = exp;
|
||||
@@ -35,10 +36,12 @@ public class BlockExpEvent extends BlockEvent {
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,7 +16,7 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
private final List<Block> blocks;
|
||||
private float yield;
|
||||
|
||||
public BlockExplodeEvent(final Block what, final List<Block> blocks, final float yield) {
|
||||
public BlockExplodeEvent(@NotNull final Block what, @NotNull final List<Block> blocks, final float yield) {
|
||||
super(what);
|
||||
this.blocks = blocks;
|
||||
this.yield = yield;
|
||||
@@ -36,6 +37,7 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return All blown-up blocks
|
||||
*/
|
||||
@NotNull
|
||||
public List<Block> blockList() {
|
||||
return blocks;
|
||||
}
|
||||
@@ -58,11 +60,13 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
this.yield = yield;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block fades, melts or disappears based on world conditions
|
||||
@@ -25,7 +26,7 @@ public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private final BlockState newState;
|
||||
|
||||
public BlockFadeEvent(final Block block, final BlockState newState) {
|
||||
public BlockFadeEvent(@NotNull final Block block, @NotNull final BlockState newState) {
|
||||
super(block);
|
||||
this.newState = newState;
|
||||
this.cancelled = false;
|
||||
@@ -38,6 +39,7 @@ public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||
* @return The block state of the block that will be fading, melting or
|
||||
* disappearing
|
||||
*/
|
||||
@NotNull
|
||||
public BlockState getNewState() {
|
||||
return newState;
|
||||
}
|
||||
@@ -50,11 +52,13 @@ public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package org.bukkit.event.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called with the block changes resulting from a player fertilizing a given
|
||||
@@ -21,7 +24,7 @@ public class BlockFertilizeEvent extends BlockEvent implements Cancellable {
|
||||
private final Player player;
|
||||
private final List<BlockState> blocks;
|
||||
|
||||
public BlockFertilizeEvent(Block theBlock, Player player, List<BlockState> blocks) {
|
||||
public BlockFertilizeEvent(@NotNull Block theBlock, @Nullable Player player, @NotNull List<BlockState> blocks) {
|
||||
super(theBlock);
|
||||
this.player = player;
|
||||
this.blocks = blocks;
|
||||
@@ -32,6 +35,7 @@ public class BlockFertilizeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return triggering player, or null if not applicable
|
||||
*/
|
||||
@Nullable
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
@@ -41,6 +45,7 @@ public class BlockFertilizeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return list of all changed blocks
|
||||
*/
|
||||
@NotNull
|
||||
public List<BlockState> getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
@@ -55,11 +60,13 @@ public class BlockFertilizeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block is formed or spreads based on world conditions.
|
||||
@@ -25,15 +26,17 @@ import org.bukkit.event.HandlerList;
|
||||
public class BlockFormEvent extends BlockGrowEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public BlockFormEvent(final Block block, final BlockState newState) {
|
||||
public BlockFormEvent(@NotNull final Block block, @NotNull final BlockState newState) {
|
||||
super(block, newState);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents events with a source block and a destination block, currently
|
||||
@@ -18,13 +19,13 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
protected BlockFace face;
|
||||
protected boolean cancel;
|
||||
|
||||
public BlockFromToEvent(final Block block, final BlockFace face) {
|
||||
public BlockFromToEvent(@NotNull final Block block, @NotNull final BlockFace face) {
|
||||
super(block);
|
||||
this.face = face;
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
public BlockFromToEvent(final Block block, final Block toBlock) {
|
||||
public BlockFromToEvent(@NotNull final Block block, @NotNull final Block toBlock) {
|
||||
super(block);
|
||||
this.to = toBlock;
|
||||
this.face = BlockFace.SELF;
|
||||
@@ -36,6 +37,7 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The BlockFace that the block is moving to
|
||||
*/
|
||||
@NotNull
|
||||
public BlockFace getFace() {
|
||||
return face;
|
||||
}
|
||||
@@ -45,6 +47,7 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The faced Block
|
||||
*/
|
||||
@NotNull
|
||||
public Block getToBlock() {
|
||||
if (to == null) {
|
||||
to = block.getRelative(face);
|
||||
@@ -60,11 +63,13 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block grows naturally in the world.
|
||||
@@ -25,7 +26,7 @@ public class BlockGrowEvent extends BlockEvent implements Cancellable {
|
||||
private final BlockState newState;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public BlockGrowEvent(final Block block, final BlockState newState) {
|
||||
public BlockGrowEvent(@NotNull final Block block, @NotNull final BlockState newState) {
|
||||
super(block);
|
||||
this.newState = newState;
|
||||
}
|
||||
@@ -35,6 +36,7 @@ public class BlockGrowEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The block state for this events block
|
||||
*/
|
||||
@NotNull
|
||||
public BlockState getNewState() {
|
||||
return newState;
|
||||
}
|
||||
@@ -47,10 +49,12 @@ public class BlockGrowEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a block is ignited. If you want to catch when a Player places
|
||||
@@ -19,15 +21,15 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
private final Block ignitingBlock;
|
||||
private boolean cancel;
|
||||
|
||||
public BlockIgniteEvent(final Block theBlock, final IgniteCause cause, final Entity ignitingEntity) {
|
||||
public BlockIgniteEvent(@NotNull final Block theBlock, @NotNull final IgniteCause cause, @NotNull final Entity ignitingEntity) {
|
||||
this(theBlock, cause, ignitingEntity, null);
|
||||
}
|
||||
|
||||
public BlockIgniteEvent(final Block theBlock, final IgniteCause cause, final Block ignitingBlock) {
|
||||
public BlockIgniteEvent(@NotNull final Block theBlock, @NotNull final IgniteCause cause, @NotNull final Block ignitingBlock) {
|
||||
this(theBlock, cause, null, ignitingBlock);
|
||||
}
|
||||
|
||||
public BlockIgniteEvent(final Block theBlock, final IgniteCause cause, final Entity ignitingEntity, final Block ignitingBlock) {
|
||||
public BlockIgniteEvent(@NotNull final Block theBlock, @NotNull final IgniteCause cause, @Nullable final Entity ignitingEntity, @Nullable final Block ignitingBlock) {
|
||||
super(theBlock);
|
||||
this.cause = cause;
|
||||
this.ignitingEntity = ignitingEntity;
|
||||
@@ -48,6 +50,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return An IgniteCause value detailing the cause of block ignition
|
||||
*/
|
||||
@NotNull
|
||||
public IgniteCause getCause() {
|
||||
return cause;
|
||||
}
|
||||
@@ -57,6 +60,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The Player that placed/ignited the fire block, or null if not ignited by a Player.
|
||||
*/
|
||||
@Nullable
|
||||
public Player getPlayer() {
|
||||
if (ignitingEntity instanceof Player) {
|
||||
return (Player) ignitingEntity;
|
||||
@@ -70,6 +74,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The Entity that placed/ignited the fire block, or null if not ignited by a Entity.
|
||||
*/
|
||||
@Nullable
|
||||
public Entity getIgnitingEntity() {
|
||||
return ignitingEntity;
|
||||
}
|
||||
@@ -79,6 +84,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The Block that placed/ignited the fire block, or null if not ignited by a Block.
|
||||
*/
|
||||
@Nullable
|
||||
public Block getIgnitingBlock() {
|
||||
return ignitingBlock;
|
||||
}
|
||||
@@ -118,11 +124,13 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
EXPLOSION,
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,7 +19,7 @@ import java.util.List;
|
||||
public class BlockMultiPlaceEvent extends BlockPlaceEvent {
|
||||
private final List<BlockState> states;
|
||||
|
||||
public BlockMultiPlaceEvent(List<BlockState> states, Block clicked, ItemStack itemInHand, Player thePlayer, boolean canBuild) {
|
||||
public BlockMultiPlaceEvent(@NotNull List<BlockState> states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) {
|
||||
super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild);
|
||||
this.states = ImmutableList.copyOf(states);
|
||||
}
|
||||
@@ -30,6 +31,7 @@ public class BlockMultiPlaceEvent extends BlockPlaceEvent {
|
||||
*
|
||||
* @return immutable list of replaced BlockStates
|
||||
*/
|
||||
@NotNull
|
||||
public List<BlockState> getReplacedBlockStates() {
|
||||
return states;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Thrown when a block physics check is called.
|
||||
@@ -31,11 +32,11 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
private final Block sourceBlock;
|
||||
private boolean cancel = false;
|
||||
|
||||
public BlockPhysicsEvent(final Block block, final BlockData changed) {
|
||||
public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) {
|
||||
this(block, changed, block);
|
||||
}
|
||||
|
||||
public BlockPhysicsEvent(final Block block, final BlockData changed, final Block sourceBlock) {
|
||||
public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed, @NotNull final Block sourceBlock) {
|
||||
super(block);
|
||||
this.changed = changed;
|
||||
this.sourceBlock = sourceBlock;
|
||||
@@ -48,6 +49,7 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The source block
|
||||
*/
|
||||
@NotNull
|
||||
public Block getSourceBlock() {
|
||||
return sourceBlock;
|
||||
}
|
||||
@@ -57,6 +59,7 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return Changed block's type
|
||||
*/
|
||||
@NotNull
|
||||
public Material getChangedType() {
|
||||
return changed.getMaterial();
|
||||
}
|
||||
@@ -69,11 +72,13 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a piston block is triggered
|
||||
@@ -12,7 +13,7 @@ public abstract class BlockPistonEvent extends BlockEvent implements Cancellable
|
||||
private boolean cancelled;
|
||||
private final BlockFace direction;
|
||||
|
||||
public BlockPistonEvent(final Block block, final BlockFace direction) {
|
||||
public BlockPistonEvent(@NotNull final Block block, @NotNull final BlockFace direction) {
|
||||
super(block);
|
||||
this.direction = direction;
|
||||
}
|
||||
@@ -39,6 +40,7 @@ public abstract class BlockPistonEvent extends BlockEvent implements Cancellable
|
||||
*
|
||||
* @return direction of the piston
|
||||
*/
|
||||
@NotNull
|
||||
public BlockFace getDirection() {
|
||||
// Both are meh!
|
||||
// return ((PistonBaseMaterial) block.getType().getNewData(block.getData())).getFacing();
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a piston extends
|
||||
@@ -17,13 +18,13 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||
private List<Block> blocks;
|
||||
|
||||
@Deprecated
|
||||
public BlockPistonExtendEvent(final Block block, final int length, final BlockFace direction) {
|
||||
public BlockPistonExtendEvent(@NotNull final Block block, final int length, @NotNull final BlockFace direction) {
|
||||
super(block, direction);
|
||||
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public BlockPistonExtendEvent(final Block block, final List<Block> blocks, final BlockFace direction) {
|
||||
public BlockPistonExtendEvent(@NotNull final Block block, @NotNull final List<Block> blocks, @NotNull final BlockFace direction) {
|
||||
super(block, direction);
|
||||
|
||||
this.length = blocks.size();
|
||||
@@ -48,6 +49,7 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||
*
|
||||
* @return Immutable list of the moved blocks.
|
||||
*/
|
||||
@NotNull
|
||||
public List<Block> getBlocks() {
|
||||
if (blocks == null) {
|
||||
ArrayList<Block> tmp = new ArrayList<Block>();
|
||||
@@ -59,11 +61,13 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a piston retracts
|
||||
@@ -13,7 +14,7 @@ public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private List<Block> blocks;
|
||||
|
||||
public BlockPistonRetractEvent(final Block block, final List<Block> blocks, final BlockFace direction) {
|
||||
public BlockPistonRetractEvent(@NotNull final Block block, @NotNull final List<Block> blocks, @NotNull final BlockFace direction) {
|
||||
super(block, direction);
|
||||
|
||||
this.blocks = blocks;
|
||||
@@ -26,6 +27,7 @@ public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||
* @return The possible location of the possibly moving block.
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public Location getRetractLocation() {
|
||||
return getBlock().getRelative(getDirection(), 2).getLocation();
|
||||
}
|
||||
@@ -36,15 +38,18 @@ public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||
*
|
||||
* @return Immutable list of the moved blocks.
|
||||
*/
|
||||
@NotNull
|
||||
public List<Block> getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block is placed by a player.
|
||||
@@ -24,11 +25,11 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
protected EquipmentSlot hand;
|
||||
|
||||
@Deprecated
|
||||
public BlockPlaceEvent(final Block placedBlock, final BlockState replacedBlockState, final Block placedAgainst, final ItemStack itemInHand, final Player thePlayer, final boolean canBuild) {
|
||||
public BlockPlaceEvent(@NotNull final Block placedBlock, @NotNull final BlockState replacedBlockState, @NotNull final Block placedAgainst, @NotNull final ItemStack itemInHand, @NotNull final Player thePlayer, final boolean canBuild) {
|
||||
this(placedBlock, replacedBlockState, placedAgainst, itemInHand, thePlayer, canBuild, EquipmentSlot.HAND);
|
||||
}
|
||||
|
||||
public BlockPlaceEvent(final Block placedBlock, final BlockState replacedBlockState, final Block placedAgainst, final ItemStack itemInHand, final Player thePlayer, final boolean canBuild, final EquipmentSlot hand) {
|
||||
public BlockPlaceEvent(@NotNull final Block placedBlock, @NotNull final BlockState replacedBlockState, @NotNull final Block placedAgainst, @NotNull final ItemStack itemInHand, @NotNull final Player thePlayer, final boolean canBuild, @NotNull final EquipmentSlot hand) {
|
||||
super(placedBlock);
|
||||
this.placedAgainst = placedAgainst;
|
||||
this.itemInHand = itemInHand;
|
||||
@@ -52,6 +53,7 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The Player who placed the block involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
@@ -62,6 +64,7 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The Block that was placed
|
||||
*/
|
||||
@NotNull
|
||||
public Block getBlockPlaced() {
|
||||
return getBlock();
|
||||
}
|
||||
@@ -72,6 +75,7 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return The BlockState for the block which was replaced.
|
||||
*/
|
||||
@NotNull
|
||||
public BlockState getBlockReplacedState() {
|
||||
return this.replacedBlockState;
|
||||
}
|
||||
@@ -81,6 +85,7 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return Block the block that the new block was placed against
|
||||
*/
|
||||
@NotNull
|
||||
public Block getBlockAgainst() {
|
||||
return placedAgainst;
|
||||
}
|
||||
@@ -91,6 +96,7 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
* @return The ItemStack for the item in the player's hand when they
|
||||
* placed the block
|
||||
*/
|
||||
@NotNull
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
}
|
||||
@@ -99,6 +105,7 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
* Gets the hand which placed the block
|
||||
* @return Main or off-hand, depending on which hand was used to place the block
|
||||
*/
|
||||
@NotNull
|
||||
public EquipmentSlot getHand() {
|
||||
return this.hand;
|
||||
}
|
||||
@@ -126,11 +133,13 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
this.canBuild = canBuild;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a redstone current changes
|
||||
@@ -11,7 +12,7 @@ public class BlockRedstoneEvent extends BlockEvent {
|
||||
private final int oldCurrent;
|
||||
private int newCurrent;
|
||||
|
||||
public BlockRedstoneEvent(final Block block, final int oldCurrent, final int newCurrent) {
|
||||
public BlockRedstoneEvent(@NotNull final Block block, final int oldCurrent, final int newCurrent) {
|
||||
super(block);
|
||||
this.oldCurrent = oldCurrent;
|
||||
this.newCurrent = newCurrent;
|
||||
@@ -44,11 +45,13 @@ public class BlockRedstoneEvent extends BlockEvent {
|
||||
this.newCurrent = newCurrent;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block spreads based on world conditions.
|
||||
@@ -24,7 +25,7 @@ public class BlockSpreadEvent extends BlockFormEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Block source;
|
||||
|
||||
public BlockSpreadEvent(final Block block, final Block source, final BlockState newState) {
|
||||
public BlockSpreadEvent(@NotNull final Block block, @NotNull final Block source, @NotNull final BlockState newState) {
|
||||
super(block, newState);
|
||||
this.source = source;
|
||||
}
|
||||
@@ -34,15 +35,18 @@ public class BlockSpreadEvent extends BlockFormEvent {
|
||||
*
|
||||
* @return the Block for the source block involved in this event.
|
||||
*/
|
||||
@NotNull
|
||||
public Block getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CauldronLevelChangeEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
@@ -16,7 +18,7 @@ public class CauldronLevelChangeEvent extends BlockEvent implements Cancellable
|
||||
private final int oldLevel;
|
||||
private int newLevel;
|
||||
|
||||
public CauldronLevelChangeEvent(Block block, Entity entity, ChangeReason reason, int oldLevel, int newLevel) {
|
||||
public CauldronLevelChangeEvent(@NotNull Block block, @Nullable Entity entity, @NotNull ChangeReason reason, int oldLevel, int newLevel) {
|
||||
super(block);
|
||||
this.entity = entity;
|
||||
this.reason = reason;
|
||||
@@ -29,10 +31,12 @@ public class CauldronLevelChangeEvent extends BlockEvent implements Cancellable
|
||||
*
|
||||
* @return acting entity
|
||||
*/
|
||||
@Nullable
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ChangeReason getReason() {
|
||||
return reason;
|
||||
}
|
||||
@@ -60,11 +64,13 @@ public class CauldronLevelChangeEvent extends BlockEvent implements Cancellable
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a block is formed by entities.
|
||||
@@ -16,7 +17,7 @@ import org.bukkit.entity.Entity;
|
||||
public class EntityBlockFormEvent extends BlockFormEvent {
|
||||
private final Entity entity;
|
||||
|
||||
public EntityBlockFormEvent(final Entity entity, final Block block, final BlockState blockstate) {
|
||||
public EntityBlockFormEvent(@NotNull final Entity entity, @NotNull final Block block, @NotNull final BlockState blockstate) {
|
||||
super(block, blockstate);
|
||||
|
||||
this.entity = entity;
|
||||
@@ -27,6 +28,7 @@ public class EntityBlockFormEvent extends BlockFormEvent {
|
||||
*
|
||||
* @return Entity involved in event
|
||||
*/
|
||||
@NotNull
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when the fluid level of a block changes due to changes in adjacent
|
||||
@@ -17,7 +18,7 @@ public class FluidLevelChangeEvent extends BlockEvent implements Cancellable {
|
||||
//
|
||||
private BlockData newData;
|
||||
|
||||
public FluidLevelChangeEvent(Block theBlock, BlockData newData) {
|
||||
public FluidLevelChangeEvent(@NotNull Block theBlock, @NotNull BlockData newData) {
|
||||
super(theBlock);
|
||||
this.newData = newData;
|
||||
}
|
||||
@@ -27,6 +28,7 @@ public class FluidLevelChangeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return new data
|
||||
*/
|
||||
@NotNull
|
||||
public BlockData getNewData() {
|
||||
return newData;
|
||||
}
|
||||
@@ -37,7 +39,7 @@ public class FluidLevelChangeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @param newData the new data
|
||||
*/
|
||||
public void setNewData(BlockData newData) {
|
||||
public void setNewData(@NotNull BlockData newData) {
|
||||
Preconditions.checkArgument(newData != null, "newData null");
|
||||
Preconditions.checkArgument(this.newData.getMaterial().equals(newData.getMaterial()), "Cannot change fluid type");
|
||||
|
||||
@@ -54,11 +56,13 @@ public class FluidLevelChangeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when leaves are decaying naturally.
|
||||
@@ -13,7 +14,7 @@ public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
|
||||
public LeavesDecayEvent(final Block block) {
|
||||
public LeavesDecayEvent(@NotNull final Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@@ -25,11 +26,13 @@ public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when the moisture level of a soil block changes.
|
||||
@@ -14,7 +15,7 @@ public class MoistureChangeEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private final BlockState newState;
|
||||
|
||||
public MoistureChangeEvent(final Block block, final BlockState newState) {
|
||||
public MoistureChangeEvent(@NotNull final Block block, @NotNull final BlockState newState) {
|
||||
super(block);
|
||||
this.newState = newState;
|
||||
this.cancelled = false;
|
||||
@@ -25,6 +26,7 @@ public class MoistureChangeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return new block state
|
||||
*/
|
||||
@NotNull
|
||||
public BlockState getNewState() {
|
||||
return newState;
|
||||
}
|
||||
@@ -39,11 +41,13 @@ public class MoistureChangeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.Note;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a note block is being played through player interaction or a
|
||||
@@ -17,7 +18,7 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
private Note note;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public NotePlayEvent(Block block, Instrument instrument, Note note) {
|
||||
public NotePlayEvent(@NotNull Block block, @NotNull Instrument instrument, @NotNull Note note) {
|
||||
super(block);
|
||||
this.instrument = instrument;
|
||||
this.note = note;
|
||||
@@ -34,8 +35,9 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the {@link Instrument} to be used.
|
||||
*
|
||||
* @return the Instrument;
|
||||
* @return the Instrument
|
||||
*/
|
||||
@NotNull
|
||||
public Instrument getInstrument() {
|
||||
return instrument;
|
||||
}
|
||||
@@ -43,8 +45,9 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the {@link Note} to be played.
|
||||
*
|
||||
* @return the Note.
|
||||
* @return the Note
|
||||
*/
|
||||
@NotNull
|
||||
public Note getNote() {
|
||||
return note;
|
||||
}
|
||||
@@ -56,11 +59,10 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
* @deprecated no effect on newer Minecraft versions
|
||||
*/
|
||||
@Deprecated
|
||||
public void setInstrument(Instrument instrument) {
|
||||
public void setInstrument(@NotNull Instrument instrument) {
|
||||
if (instrument != null) {
|
||||
this.instrument = instrument;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,17 +72,19 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
* @deprecated no effect on newer Minecraft versions
|
||||
*/
|
||||
@Deprecated
|
||||
public void setNote(Note note) {
|
||||
public void setNote(@NotNull Note note) {
|
||||
if (note != null) {
|
||||
this.note = note;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a sign is changed by a player.
|
||||
@@ -16,7 +18,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
private final Player player;
|
||||
private final String[] lines;
|
||||
|
||||
public SignChangeEvent(final Block theBlock, final Player thePlayer, final String[] theLines) {
|
||||
public SignChangeEvent(@NotNull final Block theBlock, @NotNull final Player thePlayer, @NotNull final String[] theLines) {
|
||||
super(theBlock);
|
||||
this.player = thePlayer;
|
||||
this.lines = theLines;
|
||||
@@ -27,6 +29,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return the Player involved in this event
|
||||
*/
|
||||
@NotNull
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
@@ -36,6 +39,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return the String array for the sign's lines new text
|
||||
*/
|
||||
@NotNull
|
||||
public String[] getLines() {
|
||||
return lines;
|
||||
}
|
||||
@@ -49,6 +53,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
* @throws IndexOutOfBoundsException thrown when the provided index is {@literal > 3
|
||||
* or < 0}
|
||||
*/
|
||||
@Nullable
|
||||
public String getLine(int index) throws IndexOutOfBoundsException {
|
||||
return lines[index];
|
||||
}
|
||||
@@ -61,7 +66,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
* @throws IndexOutOfBoundsException thrown when the provided index is {@literal > 3
|
||||
* or < 0}
|
||||
*/
|
||||
public void setLine(int index, String line) throws IndexOutOfBoundsException {
|
||||
public void setLine(int index, @Nullable String line) throws IndexOutOfBoundsException {
|
||||
lines[index] = line;
|
||||
}
|
||||
|
||||
@@ -73,11 +78,13 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a sponge absorbs water from the world.
|
||||
@@ -22,7 +23,7 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private final List<BlockState> blocks;
|
||||
|
||||
public SpongeAbsorbEvent(Block block, List<BlockState> waterblocks) {
|
||||
public SpongeAbsorbEvent(@NotNull Block block, @NotNull List<BlockState> waterblocks) {
|
||||
super(block);
|
||||
this.blocks = waterblocks;
|
||||
}
|
||||
@@ -35,6 +36,7 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return list of the to be removed blocks.
|
||||
*/
|
||||
@NotNull
|
||||
public List<BlockState> getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
@@ -49,11 +51,13 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user