wrote missing documentations

This commit is contained in:
Samuel Pizette
2022-12-11 14:14:37 -05:00
parent d54a2b9516
commit 8424baa285
4 changed files with 49 additions and 0 deletions

View File

@@ -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,

View File

@@ -48,6 +48,11 @@ public interface CommandBase {
*/
@NotNull CommandBase addSubcommand(@NotNull CommandBase command);
/**
* Get the subcommands of the command.
*
* @return The subcommands.
*/
@NotNull List<CommandBase> 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<String> 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<String> args) throws NotificationException {
@@ -142,6 +149,7 @@ public interface CommandBase {
* @param key key of notification message in langYml
* @param <T> the generic type of object
* @return Returns the object given or throws an exception
* @throws NotificationException the notification exception
*/
default @NotNull <T> T notifyFalse(@NotNull T obj,
@NotNull Predicate<T> predicate, @NotNull String key)

View File

@@ -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;
}

View File

@@ -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.