SPIGOT-2540: Add nullability annotations to entire Bukkit API

By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
Bukkit/Spigot
2019-03-13 17:42:57 +11:00
parent e069a80fd8
commit 416c865476
565 changed files with 5372 additions and 2008 deletions

View File

@@ -7,6 +7,8 @@ import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents an area effect cloud which will imbue a potion effect onto
@@ -123,6 +125,7 @@ public interface AreaEffectCloud extends Entity {
*
* @return particle the set particle type
*/
@NotNull
Particle getParticle();
/**
@@ -130,7 +133,7 @@ public interface AreaEffectCloud extends Entity {
*
* @param particle the new particle type
*/
void setParticle(Particle particle);
void setParticle(@NotNull Particle particle);
/**
* Sets the particle which this cloud will be composed of
@@ -139,20 +142,21 @@ public interface AreaEffectCloud extends Entity {
* @param data the data to use for the particle or null,
* the type of this depends on {@link Particle#getDataType()}
*/
<T> void setParticle(Particle particle, T data);
<T> void setParticle(@NotNull Particle particle, @Nullable T data);
/**
* Sets the underlying potion data
*
* @param data PotionData to set the base potion state to
*/
void setBasePotionData(PotionData data);
void setBasePotionData(@NotNull PotionData data);
/**
* Returns the potion data about the base potion
*
* @return a PotionData object
*/
@NotNull
PotionData getBasePotionData();
/**
@@ -171,6 +175,7 @@ public interface AreaEffectCloud extends Entity {
*
* @return the immutable list of custom potion effects
*/
@NotNull
List<PotionEffect> getCustomEffects();
/**
@@ -181,7 +186,7 @@ public interface AreaEffectCloud extends Entity {
* overwritten
* @return true if the effect was added as a result of this call
*/
boolean addCustomEffect(PotionEffect effect, boolean overwrite);
boolean addCustomEffect(@NotNull PotionEffect effect, boolean overwrite);
/**
* Removes a custom potion effect from this cloud.
@@ -189,7 +194,7 @@ public interface AreaEffectCloud extends Entity {
* @param type the potion effect type to remove
* @return true if the an effect was removed as a result of this call
*/
boolean removeCustomEffect(PotionEffectType type);
boolean removeCustomEffect(@NotNull PotionEffectType type);
/**
* Checks for a specific custom potion effect type on this cloud.
@@ -197,7 +202,7 @@ public interface AreaEffectCloud extends Entity {
* @param type the potion effect type to check for
* @return true if the potion has this effect
*/
boolean hasCustomEffect(PotionEffectType type);
boolean hasCustomEffect(@Nullable PotionEffectType type);
/**
* Removes all custom potion effects from this cloud.
@@ -209,6 +214,7 @@ public interface AreaEffectCloud extends Entity {
*
* @return cloud color
*/
@NotNull
Color getColor();
/**
@@ -216,13 +222,14 @@ public interface AreaEffectCloud extends Entity {
*
* @param color cloud color
*/
void setColor(Color color);
void setColor(@NotNull Color color);
/**
* Retrieve the original source of this cloud.
*
* @return the {@link ProjectileSource} that threw the LingeringPotion
*/
@Nullable
public ProjectileSource getSource();
/**
@@ -230,5 +237,5 @@ public interface AreaEffectCloud extends Entity {
*
* @param source the {@link ProjectileSource} that threw the LingeringPotion
*/
public void setSource(ProjectileSource source);
public void setSource(@Nullable ProjectileSource source);
}