SPIGOT-2540: Add nullability annotations to entire Bukkit API
By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
@@ -2,6 +2,8 @@ package org.bukkit.permissions;
|
||||
|
||||
import java.util.Set;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an object that may be assigned permissions
|
||||
@@ -15,7 +17,7 @@ public interface Permissible extends ServerOperator {
|
||||
* @param name Name of the permission
|
||||
* @return true if the permission is set, otherwise false
|
||||
*/
|
||||
public boolean isPermissionSet(String name);
|
||||
public boolean isPermissionSet(@NotNull String name);
|
||||
|
||||
/**
|
||||
* Checks if this object contains an override for the specified {@link
|
||||
@@ -24,7 +26,7 @@ public interface Permissible extends ServerOperator {
|
||||
* @param perm Permission to check
|
||||
* @return true if the permission is set, otherwise false
|
||||
*/
|
||||
public boolean isPermissionSet(Permission perm);
|
||||
public boolean isPermissionSet(@NotNull Permission perm);
|
||||
|
||||
/**
|
||||
* Gets the value of the specified permission, if set.
|
||||
@@ -35,7 +37,7 @@ public interface Permissible extends ServerOperator {
|
||||
* @param name Name of the permission
|
||||
* @return Value of the permission
|
||||
*/
|
||||
public boolean hasPermission(String name);
|
||||
public boolean hasPermission(@NotNull String name);
|
||||
|
||||
/**
|
||||
* Gets the value of the specified permission, if set.
|
||||
@@ -46,7 +48,7 @@ public interface Permissible extends ServerOperator {
|
||||
* @param perm Permission to get
|
||||
* @return Value of the permission
|
||||
*/
|
||||
public boolean hasPermission(Permission perm);
|
||||
public boolean hasPermission(@NotNull Permission perm);
|
||||
|
||||
/**
|
||||
* Adds a new {@link PermissionAttachment} with a single permission by
|
||||
@@ -58,7 +60,8 @@ public interface Permissible extends ServerOperator {
|
||||
* @param value Value of the permission
|
||||
* @return The PermissionAttachment that was just created
|
||||
*/
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value);
|
||||
@NotNull
|
||||
public PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value);
|
||||
|
||||
/**
|
||||
* Adds a new empty {@link PermissionAttachment} to this object
|
||||
@@ -67,7 +70,8 @@ public interface Permissible extends ServerOperator {
|
||||
* or disabled
|
||||
* @return The PermissionAttachment that was just created
|
||||
*/
|
||||
public PermissionAttachment addAttachment(Plugin plugin);
|
||||
@NotNull
|
||||
public PermissionAttachment addAttachment(@NotNull Plugin plugin);
|
||||
|
||||
/**
|
||||
* Temporarily adds a new {@link PermissionAttachment} with a single
|
||||
@@ -81,7 +85,8 @@ public interface Permissible extends ServerOperator {
|
||||
* after
|
||||
* @return The PermissionAttachment that was just created
|
||||
*/
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks);
|
||||
@Nullable
|
||||
public PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks);
|
||||
|
||||
/**
|
||||
* Temporarily adds a new empty {@link PermissionAttachment} to this
|
||||
@@ -93,7 +98,8 @@ public interface Permissible extends ServerOperator {
|
||||
* after
|
||||
* @return The PermissionAttachment that was just created
|
||||
*/
|
||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks);
|
||||
@Nullable
|
||||
public PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks);
|
||||
|
||||
/**
|
||||
* Removes the given {@link PermissionAttachment} from this object
|
||||
@@ -102,7 +108,7 @@ public interface Permissible extends ServerOperator {
|
||||
* @throws IllegalArgumentException Thrown when the specified attachment
|
||||
* isn't part of this object
|
||||
*/
|
||||
public void removeAttachment(PermissionAttachment attachment);
|
||||
public void removeAttachment(@NotNull PermissionAttachment attachment);
|
||||
|
||||
/**
|
||||
* Recalculates the permissions for this object, if the attachments have
|
||||
@@ -118,5 +124,6 @@ public interface Permissible extends ServerOperator {
|
||||
*
|
||||
* @return Set of currently effective permissions
|
||||
*/
|
||||
@NotNull
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user