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

@@ -4,6 +4,7 @@ import org.bukkit.World;
import org.bukkit.entity.LightningStrike;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Stores data for lightning striking
@@ -15,11 +16,11 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
private final Cause cause;
@Deprecated
public LightningStrikeEvent(final World world, final LightningStrike bolt) {
public LightningStrikeEvent(@NotNull final World world, @NotNull final LightningStrike bolt) {
this(world, bolt, Cause.UNKNOWN);
}
public LightningStrikeEvent(final World world, final LightningStrike bolt, final Cause cause) {
public LightningStrikeEvent(@NotNull final World world, @NotNull final LightningStrike bolt, @NotNull final Cause cause) {
super(world);
this.bolt = bolt;
this.cause = cause;
@@ -38,6 +39,7 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
*
* @return lightning entity
*/
@NotNull
public LightningStrike getLightning() {
return bolt;
}
@@ -47,15 +49,18 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
*
* @return strike cause
*/
@NotNull
public Cause getCause() {
return cause;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}

View File

@@ -3,6 +3,7 @@ package org.bukkit.event.weather;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Stores data for thunder state changing in a world
@@ -12,7 +13,7 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
private boolean canceled;
private final boolean to;
public ThunderChangeEvent(final World world, final boolean to) {
public ThunderChangeEvent(@NotNull final World world, final boolean to) {
super(world);
this.to = to;
}
@@ -34,11 +35,13 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
return to;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}

View File

@@ -3,6 +3,7 @@ package org.bukkit.event.weather;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Stores data for weather changing in a world
@@ -12,7 +13,7 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
private boolean canceled;
private final boolean to;
public WeatherChangeEvent(final World world, final boolean to) {
public WeatherChangeEvent(@NotNull final World world, final boolean to) {
super(world);
this.to = to;
}
@@ -34,11 +35,13 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
return to;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}

View File

@@ -2,6 +2,7 @@ package org.bukkit.event.weather;
import org.bukkit.World;
import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
/**
* Represents a Weather-related event
@@ -9,7 +10,7 @@ import org.bukkit.event.Event;
public abstract class WeatherEvent extends Event {
protected World world;
public WeatherEvent(final World where) {
public WeatherEvent(@NotNull final World where) {
world = where;
}
@@ -18,6 +19,7 @@ public abstract class WeatherEvent extends Event {
*
* @return World this event is occurring in
*/
@NotNull
public final World getWorld() {
return world;
}