Add SWCommand.Register.description to simplify help commands
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
f1e5e39156
Commit
745ac401bb
@ -47,6 +47,7 @@ public abstract class SWCommand {
|
||||
|
||||
@Setter
|
||||
private Message message = null;
|
||||
private List<String> defaultHelpMessages = new ArrayList<>();
|
||||
|
||||
protected SWCommand(String command) {
|
||||
this(command, new String[0]);
|
||||
@ -205,6 +206,10 @@ public abstract class SWCommand {
|
||||
});
|
||||
}
|
||||
|
||||
public void addDefaultHelpMessage(String message) {
|
||||
defaultHelpMessages.add(message);
|
||||
}
|
||||
|
||||
private List<Method> methods() {
|
||||
List<Method> methods = new ArrayList<>(Arrays.asList(getClass().getDeclaredMethods()));
|
||||
methods.addAll(Arrays.asList(SWCommand.class.getDeclaredMethods()));
|
||||
@ -228,6 +233,7 @@ public abstract class SWCommand {
|
||||
}
|
||||
try {
|
||||
message.sendPrefixless("COMMAND_HELP_HEAD", p, command.getName());
|
||||
defaultHelpMessages.forEach(s -> message.sendPrefixless(s, p));
|
||||
} catch (Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to send help message", e);
|
||||
return;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren