1
0
This commit is contained in:
Lee
2024-03-20 17:50:17 +00:00
parent d9a2fd16d0
commit 6d376a26f6
8 changed files with 38 additions and 5 deletions

View File

@ -20,6 +20,8 @@ public class Aetheria extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();
new CommandManager();
new WorldSizeManager();
new ColorManager();

View File

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

View File

@ -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) {

View 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("&", "§"));
}
}
}

View File

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

View File

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

View 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"

View File

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