help cmd
This commit is contained in:
@ -20,6 +20,8 @@ public class Aetheria extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
saveDefaultConfig();
|
||||
|
||||
new CommandManager();
|
||||
new WorldSizeManager();
|
||||
new ColorManager();
|
||||
|
@ -11,8 +11,6 @@ public abstract class Command implements CommandExecutor {
|
||||
|
||||
private final String command;
|
||||
|
||||
private final String[] permissions;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, org.bukkit.command.@NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||
execute(commandSender, strings);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cc.fascinated.command;
|
||||
|
||||
import cc.fascinated.Aetheria;
|
||||
import cc.fascinated.command.impl.HelpCommand;
|
||||
import cc.fascinated.command.impl.TotalJoinsCommand;
|
||||
|
||||
import java.util.Objects;
|
||||
@ -9,6 +10,7 @@ public class CommandManager {
|
||||
|
||||
public CommandManager() {
|
||||
registerCommand(new TotalJoinsCommand());
|
||||
registerCommand(new HelpCommand());
|
||||
}
|
||||
|
||||
public static void registerCommand(Command command) {
|
||||
|
24
src/main/java/cc/fascinated/command/impl/HelpCommand.java
Normal file
24
src/main/java/cc/fascinated/command/impl/HelpCommand.java
Normal file
@ -0,0 +1,24 @@
|
||||
package cc.fascinated.command.impl;
|
||||
|
||||
import cc.fascinated.Aetheria;
|
||||
import cc.fascinated.command.Command;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class HelpCommand extends Command {
|
||||
|
||||
public HelpCommand() {
|
||||
super("help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender commandSender, String[] args) {
|
||||
commandSender.sendPlainMessage("§6§lAetheria §7» §fCommands:");
|
||||
for (String line : Objects.requireNonNull(Aetheria.INSTANCE.getConfig().getStringList("help-command"))) {
|
||||
commandSender.sendPlainMessage(" " + line.replaceAll("&", "§"));
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
public class TotalJoinsCommand extends Command {
|
||||
|
||||
public TotalJoinsCommand() {
|
||||
super("totaljoins", new String[]{ "aetheria.command.totaljoins" });
|
||||
super("totaljoins");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
public class WorldSizeCommand extends Command {
|
||||
|
||||
public WorldSizeCommand() {
|
||||
super("worldsize", new String[]{ "aetheria.command.worldsize" });
|
||||
super("worldsize");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
4
src/main/resources/config.yml
Normal file
4
src/main/resources/config.yml
Normal file
@ -0,0 +1,4 @@
|
||||
help-command:
|
||||
- "&e/help &7- &fShows this help message"
|
||||
- "&e/kill &7- &fKills you"
|
||||
- "&e/worldsize &7- &fShows the total file size of all worlds"
|
@ -7,4 +7,7 @@ commands:
|
||||
usage: "/totaljoins"
|
||||
worldsize:
|
||||
description: "Shows the size of all worlds"
|
||||
usage: "/worldsize"
|
||||
usage: "/worldsize"
|
||||
help:
|
||||
description: "Shows the help message"
|
||||
usage: "/help"
|
Reference in New Issue
Block a user