diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index 2cf57f36b..f8e100226 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -164,7 +164,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public boolean hasPermission(final String permission) { + @Override public boolean hasPermission(@NotNull final String permission) { if (this.offline && EconHandler.getEconHandler() != null) { return EconHandler.getEconHandler().hasPermission(getName(), permission); } @@ -231,7 +231,7 @@ public class BukkitPlayer extends PlotPlayer { return max; } - @Override public boolean isPermissionSet(final String permission) { + @Override public boolean isPermissionSet(@NotNull final String permission) { return this.player.isPermissionSet(permission); } diff --git a/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java b/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java index 1868556f3..36f040a17 100644 --- a/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java +++ b/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java @@ -29,6 +29,10 @@ import com.plotsquared.core.configuration.Caption; import net.kyori.adventure.text.minimessage.Template; import org.jetbrains.annotations.NotNull; +/** + * Any entity that is able to execute commands, receive messages & and have + * permission nodes + */ public interface CommandCaller { /** @@ -44,9 +48,22 @@ public interface CommandCaller { * * @param permission the name of the permission */ - boolean hasPermission(String permission); + boolean hasPermission(@NotNull String permission); - boolean isPermissionSet(String permission); + /** + * Checks if this object contains an override for the specified + * permission, by fully qualified name + * + * @param permission Name of the permission + * @return true if the permission is set, otherwise false + */ + boolean isPermissionSet(@NotNull String permission); + + /** + * Get the type of the caller + * + * @return Caller type + */ + @NotNull RequiredType getSuperCaller(); - RequiredType getSuperCaller(); } diff --git a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java index 9a97800e7..7e265541a 100644 --- a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java @@ -99,11 +99,11 @@ public class ConsolePlayer extends PlotPlayer { return 0; } - @Override public boolean hasPermission(String permission) { + @Override public boolean hasPermission(@NotNull String permission) { return true; } - @Override public boolean isPermissionSet(String permission) { + @Override public boolean isPermissionSet(@NotNull String permission) { return true; } @@ -137,7 +137,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void removeAttribute(String key) { } - @Override public RequiredType getSuperCaller() { + @Override @NotNull public RequiredType getSuperCaller() { return RequiredType.CONSOLE; } diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index 8455d285e..5554ec89a 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -361,7 +361,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, return PlotSquared.get().getApplicablePlotArea(getLocation()); } - @Override public RequiredType getSuperCaller() { + @Override @NotNull public RequiredType getSuperCaller() { return RequiredType.PLAYER; }