|
1 | | -package me.croabeast.command; |
2 | | - |
3 | | -import org.jetbrains.annotations.NotNull; |
4 | | - |
5 | | -import java.util.List; |
6 | | - |
7 | | -/** |
8 | | - * Represents the base structure of a command, including its name, aliases, and executable action. |
9 | | - * <p> |
10 | | - * A {@code BaseCommand} defines the essential properties of a command: |
11 | | - * <ul> |
12 | | - * <li>The command name, as returned by {@link #getName()}.</li> |
13 | | - * <li>A list of alternative names (aliases) via {@link #getAliases()}.</li> |
14 | | - * <li>An executable action defined by {@link Executable}, which is run when the command is invoked.</li> |
15 | | - * </ul> |
16 | | - * </p> |
17 | | - * <p> |
18 | | - * Implementations of this interface are expected to provide concrete logic for the command's behavior, |
19 | | - * as well as its permission node via {@link Permissible#getPermission()}. |
20 | | - * </p> |
21 | | - * |
22 | | - * <p> |
23 | | - * Example usage: |
24 | | - * <pre><code> |
25 | | - * public class MyCommand implements BaseCommand { |
26 | | - * {@literal @}Override |
27 | | - * public String getName() { |
28 | | - * return "mycommand"; |
29 | | - * } |
30 | | - * |
31 | | - * {@literal @}Override |
32 | | - * public List<String> getAliases() { |
33 | | - * return Arrays.asList("mc", "mycmd"); |
34 | | - * } |
35 | | - * |
36 | | - * {@literal @}Override |
37 | | - * public Executable getExecutable() { |
38 | | - * return (sender, args) -> { |
39 | | - * // command execution logic |
40 | | - * return Executable.State.TRUE; |
41 | | - * }; |
42 | | - * } |
43 | | - * |
44 | | - * {@literal @}Override |
45 | | - * public String getPermission() { |
46 | | - * return "myplugin.mycommand"; |
47 | | - * } |
48 | | - * }</code></pre></p> |
49 | | - * |
50 | | - * @see Permissible |
51 | | - * @see Executable |
52 | | - */ |
53 | | -public interface BaseCommand extends Permissible { |
54 | | - |
55 | | - /** |
56 | | - * Gets the primary name of the command. |
57 | | - * |
58 | | - * @return the command name as a {@link String}. |
59 | | - */ |
60 | | - @NotNull |
61 | | - String getName(); |
62 | | - |
63 | | - /** |
64 | | - * Gets the list of aliases for the command. |
65 | | - * <p> |
66 | | - * Aliases are alternative names that can be used to invoke the command. |
67 | | - * </p> |
68 | | - * |
69 | | - * @return a {@link List} of alias strings. |
70 | | - */ |
71 | | - @NotNull |
72 | | - List<String> getAliases(); |
73 | | - |
74 | | - /** |
75 | | - * Gets the executable action associated with this command. |
76 | | - * <p> |
77 | | - * The returned {@link Executable} defines the logic that is run when the command is invoked. |
78 | | - * </p> |
79 | | - * |
80 | | - * @return the {@link Executable} instance representing the command's behavior. |
81 | | - */ |
82 | | - @NotNull |
83 | | - Executable getExecutable(); |
84 | | -} |
| 1 | +package me.croabeast.command; |
| 2 | + |
| 3 | +import org.jetbrains.annotations.NotNull; |
| 4 | + |
| 5 | +import java.util.List; |
| 6 | + |
| 7 | +/** |
| 8 | + * Represents the base structure of a command, including its name, aliases, and executable action. |
| 9 | + * <p> |
| 10 | + * A {@code BaseCommand} defines the essential properties of a command: |
| 11 | + * <ul> |
| 12 | + * <li>The command name, as returned by {@link #getName()}.</li> |
| 13 | + * <li>A list of alternative names (aliases) via {@link #getAliases()}.</li> |
| 14 | + * <li>An executable action defined by {@link Executable}, which is run when the command is invoked.</li> |
| 15 | + * </ul> |
| 16 | + * </p> |
| 17 | + * <p> |
| 18 | + * Implementations of this interface are expected to provide concrete logic for the command's behavior, |
| 19 | + * as well as its permission node via {@link Permissible#getPermission()}. |
| 20 | + * </p> |
| 21 | + * |
| 22 | + * <p> |
| 23 | + * Example usage: |
| 24 | + * <pre><code> |
| 25 | + * public class MyCommand implements BaseCommand { |
| 26 | + * {@literal @}Override |
| 27 | + * public String getName() { |
| 28 | + * return "mycommand"; |
| 29 | + * } |
| 30 | + * |
| 31 | + * {@literal @}Override |
| 32 | + * public List<String> getAliases() { |
| 33 | + * return Arrays.asList("mc", "mycmd"); |
| 34 | + * } |
| 35 | + * |
| 36 | + * {@literal @}Override |
| 37 | + * public Executable getExecutable() { |
| 38 | + * return (sender, args) -> { |
| 39 | + * // command execution logic |
| 40 | + * return Executable.State.TRUE; |
| 41 | + * }; |
| 42 | + * } |
| 43 | + * |
| 44 | + * {@literal @}Override |
| 45 | + * public String getPermission() { |
| 46 | + * return "myplugin.mycommand"; |
| 47 | + * } |
| 48 | + * }</code></pre></p> |
| 49 | + * |
| 50 | + * @see Permissible |
| 51 | + * @see Executable |
| 52 | + */ |
| 53 | +public interface BaseCommand extends Permissible { |
| 54 | + |
| 55 | + /** |
| 56 | + * Gets the primary name of the command. |
| 57 | + * |
| 58 | + * @return the command name as a {@link String}. |
| 59 | + */ |
| 60 | + @NotNull |
| 61 | + String getName(); |
| 62 | + |
| 63 | + /** |
| 64 | + * Gets the list of aliases for the command. |
| 65 | + * <p> |
| 66 | + * Aliases are alternative names that can be used to invoke the command. |
| 67 | + * </p> |
| 68 | + * |
| 69 | + * @return a {@link List} of alias strings. |
| 70 | + */ |
| 71 | + @NotNull |
| 72 | + List<String> getAliases(); |
| 73 | + |
| 74 | + /** |
| 75 | + * Gets the executable action associated with this command. |
| 76 | + * <p> |
| 77 | + * The returned {@link Executable} defines the logic that is run when the command is invoked. |
| 78 | + * </p> |
| 79 | + * |
| 80 | + * @return the {@link Executable} instance representing the command's behavior. |
| 81 | + */ |
| 82 | + @NotNull |
| 83 | + Executable getExecutable(); |
| 84 | +} |
0 commit comments