Added nullability annotations on User#hasPermission() and User#getSender()

This commit is contained in:
Florian CUNY 2019-12-23 14:02:50 +01:00
parent 2ad661b11a
commit acf87efd9b

View File

@ -223,6 +223,7 @@ public class User {
return offlinePlayer != null; return offlinePlayer != null;
} }
@Nullable
public CommandSender getSender() { public CommandSender getSender() {
return sender; return sender;
} }
@ -233,10 +234,10 @@ public class User {
/** /**
* @param permission permission string * @param permission permission string
* @return true if permission is empty or if the player has that permission or if the player is op. * @return true if permission is empty or null or if the player has that permission or if the player is op.
*/ */
public boolean hasPermission(String permission) { public boolean hasPermission(@Nullable String permission) {
return permission.isEmpty() || isOp() || sender.hasPermission(permission); return permission == null || permission.isEmpty() || isOp() || sender.hasPermission(permission);
} }
/** /**