mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
SPIGOT-2540: Add nullability annotations to entire Bukkit API
By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Indicates that a block can be attached to another block
|
||||
@@ -12,5 +13,6 @@ public interface Attachable extends Directional {
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
@NotNull
|
||||
public BlockFace getAttachedFace();
|
||||
}
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.UndefinedNullability;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An object that can be colored.
|
||||
@@ -15,6 +17,7 @@ public interface Colorable {
|
||||
*
|
||||
* @return The DyeColor of this object.
|
||||
*/
|
||||
@Nullable
|
||||
public DyeColor getColor();
|
||||
|
||||
/**
|
||||
@@ -24,7 +27,8 @@ public interface Colorable {
|
||||
* object has a special default color (e.g Shulkers).
|
||||
*
|
||||
* @param color The color of the object, as a DyeColor.
|
||||
* @throws NullPointerException if argument is null and this implementation does not support null
|
||||
*/
|
||||
public void setColor(DyeColor color);
|
||||
public void setColor(@UndefinedNullability("defined by subclass") DyeColor color);
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface Directional {
|
||||
|
||||
@@ -9,12 +10,13 @@ public interface Directional {
|
||||
*
|
||||
* @param face The facing direction
|
||||
*/
|
||||
public void setFacingDirection(BlockFace face);
|
||||
public void setFacingDirection(@NotNull BlockFace face);
|
||||
|
||||
/**
|
||||
* Gets the direction this block is facing
|
||||
*
|
||||
* @return the direction this block is facing
|
||||
*/
|
||||
@NotNull
|
||||
public BlockFace getFacing();
|
||||
}
|
||||
|
@@ -5,6 +5,8 @@ import java.util.Map;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the different textured blocks of mushroom.
|
||||
@@ -70,7 +72,7 @@ public enum MushroomBlockTexture {
|
||||
private final Byte data;
|
||||
private final BlockFace capFace;
|
||||
|
||||
private MushroomBlockTexture(final int data, final BlockFace capFace) {
|
||||
private MushroomBlockTexture(final int data, @Nullable final BlockFace capFace) {
|
||||
this.data = (byte) data;
|
||||
this.capFace = capFace;
|
||||
}
|
||||
@@ -91,6 +93,7 @@ public enum MushroomBlockTexture {
|
||||
*
|
||||
* @return The cap face
|
||||
*/
|
||||
@Nullable
|
||||
public BlockFace getCapFace() {
|
||||
return capFace;
|
||||
}
|
||||
@@ -104,6 +107,7 @@ public enum MushroomBlockTexture {
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public static MushroomBlockTexture getByData(final byte data) {
|
||||
return BY_DATA.get(data);
|
||||
}
|
||||
@@ -117,7 +121,8 @@ public enum MushroomBlockTexture {
|
||||
*
|
||||
* @see BlockFace
|
||||
*/
|
||||
public static MushroomBlockTexture getCapByFace(final BlockFace face) {
|
||||
@Nullable
|
||||
public static MushroomBlockTexture getCapByFace(@Nullable final BlockFace face) {
|
||||
return BY_BLOCKFACE.get(face);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user