SPIGOT-2540: Add nullability annotations to entire Bukkit API
By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
@ -7,6 +7,9 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.metadata.Metadatable;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a block, which will not change
|
||||
@ -25,6 +28,7 @@ public interface BlockState extends Metadatable {
|
||||
* @return the block represented by this block state
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
@NotNull
|
||||
Block getBlock();
|
||||
|
||||
/**
|
||||
@ -32,6 +36,7 @@ public interface BlockState extends Metadatable {
|
||||
*
|
||||
* @return block specific metadata
|
||||
*/
|
||||
@NotNull
|
||||
MaterialData getData();
|
||||
|
||||
/**
|
||||
@ -39,6 +44,7 @@ public interface BlockState extends Metadatable {
|
||||
*
|
||||
* @return block specific data
|
||||
*/
|
||||
@NotNull
|
||||
BlockData getBlockData();
|
||||
|
||||
/**
|
||||
@ -46,6 +52,7 @@ public interface BlockState extends Metadatable {
|
||||
*
|
||||
* @return block type
|
||||
*/
|
||||
@NotNull
|
||||
Material getType();
|
||||
|
||||
/**
|
||||
@ -62,6 +69,7 @@ public interface BlockState extends Metadatable {
|
||||
* @return the world containing the block represented by this block state
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
@NotNull
|
||||
World getWorld();
|
||||
|
||||
/**
|
||||
@ -92,6 +100,7 @@ public interface BlockState extends Metadatable {
|
||||
*
|
||||
* @return the location
|
||||
*/
|
||||
@NotNull
|
||||
Location getLocation();
|
||||
|
||||
/**
|
||||
@ -105,7 +114,9 @@ public interface BlockState extends Metadatable {
|
||||
* @param loc the location to copy into
|
||||
* @return The Location object provided or null
|
||||
*/
|
||||
Location getLocation(Location loc);
|
||||
@Contract("null -> null; !null -> !null")
|
||||
@Nullable
|
||||
Location getLocation(@Nullable Location loc);
|
||||
|
||||
/**
|
||||
* Gets the chunk which contains the block represented by this block state.
|
||||
@ -113,6 +124,7 @@ public interface BlockState extends Metadatable {
|
||||
* @return the containing Chunk
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
@NotNull
|
||||
Chunk getChunk();
|
||||
|
||||
/**
|
||||
@ -120,21 +132,21 @@ public interface BlockState extends Metadatable {
|
||||
*
|
||||
* @param data New block specific metadata
|
||||
*/
|
||||
void setData(MaterialData data);
|
||||
void setData(@NotNull MaterialData data);
|
||||
|
||||
/**
|
||||
* Sets the data for this block state.
|
||||
*
|
||||
* @param data New block specific data
|
||||
*/
|
||||
void setBlockData(BlockData data);
|
||||
void setBlockData(@NotNull BlockData data);
|
||||
|
||||
/**
|
||||
* Sets the type of this block state.
|
||||
*
|
||||
* @param type Material to change this block state to
|
||||
*/
|
||||
void setType(Material type);
|
||||
void setType(@NotNull Material type);
|
||||
|
||||
/**
|
||||
* Attempts to update the block represented by this state, setting it to
|
||||
|
||||
Reference in New Issue
Block a user