help cmd
This commit is contained in:
@ -20,6 +20,8 @@ public class Aetheria extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
saveDefaultConfig();
|
||||||
|
|
||||||
new CommandManager();
|
new CommandManager();
|
||||||
new WorldSizeManager();
|
new WorldSizeManager();
|
||||||
new ColorManager();
|
new ColorManager();
|
||||||
|
@ -11,8 +11,6 @@ public abstract class Command implements CommandExecutor {
|
|||||||
|
|
||||||
private final String command;
|
private final String command;
|
||||||
|
|
||||||
private final String[] permissions;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender commandSender, org.bukkit.command.@NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
public boolean onCommand(@NotNull CommandSender commandSender, org.bukkit.command.@NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||||
execute(commandSender, strings);
|
execute(commandSender, strings);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cc.fascinated.command;
|
package cc.fascinated.command;
|
||||||
|
|
||||||
import cc.fascinated.Aetheria;
|
import cc.fascinated.Aetheria;
|
||||||
|
import cc.fascinated.command.impl.HelpCommand;
|
||||||
import cc.fascinated.command.impl.TotalJoinsCommand;
|
import cc.fascinated.command.impl.TotalJoinsCommand;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -9,6 +10,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
public CommandManager() {
|
public CommandManager() {
|
||||||
registerCommand(new TotalJoinsCommand());
|
registerCommand(new TotalJoinsCommand());
|
||||||
|
registerCommand(new HelpCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerCommand(Command command) {
|
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 class TotalJoinsCommand extends Command {
|
||||||
|
|
||||||
public TotalJoinsCommand() {
|
public TotalJoinsCommand() {
|
||||||
super("totaljoins", new String[]{ "aetheria.command.totaljoins" });
|
super("totaljoins");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
public class WorldSizeCommand extends Command {
|
public class WorldSizeCommand extends Command {
|
||||||
|
|
||||||
public WorldSizeCommand() {
|
public WorldSizeCommand() {
|
||||||
super("worldsize", new String[]{ "aetheria.command.worldsize" });
|
super("worldsize");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"
|
@ -8,3 +8,6 @@ commands:
|
|||||||
worldsize:
|
worldsize:
|
||||||
description: "Shows the size of all worlds"
|
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