diff --git a/eco-api/src/main/java/com/willfp/eco/core/Eco.java b/eco-api/src/main/java/com/willfp/eco/core/Eco.java index 51451534..d6a58d2d 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/Eco.java +++ b/eco-api/src/main/java/com/willfp/eco/core/Eco.java @@ -159,6 +159,16 @@ public interface Eco { @NotNull EcoPlugin getEcoPlugin(); + /** + * Create PluginCommandBase implementation of {@link PluginCommand}. + * + * @param parentDelegate the enclosing class of this implementation. + * @param plugin the plugin. + * @param name the name of the command. + * @param permission the permission of the command. + * @param playersOnly if the command is players only. + * @return The PluginCommandBase implementation + */ @NotNull PluginCommandBase createPluginCommand(@NotNull CommandBase parentDelegate, @NotNull EcoPlugin plugin, @@ -166,6 +176,16 @@ public interface Eco { @NotNull String permission, boolean playersOnly); + /** + * Create CommandBase implementation of {@link com.willfp.eco.core.command.impl.Subcommand Subcommand}. + * + * @param parentDelegate the enclosing class of this implementation. + * @param plugin the plugin. + * @param name the name of the command. + * @param permission the permission of the command. + * @param playersOnly if the command is players only. + * @return The CommandBase implementation + */ @NotNull CommandBase createSubCommand(@NotNull CommandBase parentDelegate, @NotNull EcoPlugin plugin, diff --git a/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java b/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java index 3bbc538f..d0c0b8d1 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java +++ b/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java @@ -48,6 +48,11 @@ public interface CommandBase { */ @NotNull CommandBase addSubcommand(@NotNull CommandBase command); + /** + * Get the subcommands of the command. + * + * @return The subcommands. + */ @NotNull List getSubcommands(); @NotNull CommandBase getWrapped(); @@ -57,6 +62,7 @@ public interface CommandBase { * * @param sender The sender. * @param args The args. + * @throws NotificationException The notification exception. */ default void onExecute(@NotNull CommandSender sender, @NotNull List args) throws NotificationException { @@ -68,6 +74,7 @@ public interface CommandBase { * * @param sender The sender. * @param args The args. + * @throws NotificationException The notification exception. */ default void onExecute(@NotNull Player sender, @NotNull List args) throws NotificationException { @@ -142,6 +149,7 @@ public interface CommandBase { * @param key key of notification message in langYml * @param the generic type of object * @return Returns the object given or throws an exception + * @throws NotificationException the notification exception */ default @NotNull T notifyFalse(@NotNull T obj, @NotNull Predicate predicate, @NotNull String key) diff --git a/eco-api/src/main/java/com/willfp/eco/core/command/NotificationException.java b/eco-api/src/main/java/com/willfp/eco/core/command/NotificationException.java index b8b6f081..4fab3828 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/command/NotificationException.java +++ b/eco-api/src/main/java/com/willfp/eco/core/command/NotificationException.java @@ -1,14 +1,31 @@ package com.willfp.eco.core.command; +/** + * An Exception class used for notifying a sender + * with a langYml message + */ public class NotificationException extends Exception { + /** + * The langYml key of the notification string. + */ private final String key; + /** + * Creates a notification exception. + * + * @param key the lang key of the notification. + */ public NotificationException(String key) { super(key); this.key = key; } + /** + * Get the lang key. + * + * @return the lang key + */ public String getKey() { return key; } diff --git a/eco-api/src/main/java/com/willfp/eco/core/command/PluginCommandBase.java b/eco-api/src/main/java/com/willfp/eco/core/command/PluginCommandBase.java index 28b2c568..f059a894 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/command/PluginCommandBase.java +++ b/eco-api/src/main/java/com/willfp/eco/core/command/PluginCommandBase.java @@ -6,6 +6,10 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; +/** + * Interface used for discriminating between Plugin-level + * commands and sub commands. + */ public interface PluginCommandBase extends CommandBase { /** * Register the PluginCommandBase to the bukkit commandMap.