mirror of
https://github.com/Anime-Game-Servers/AGSLunarCore.git
synced 2025-02-17 10:17:45 +00:00
Add a simple /help command
This commit is contained in:
parent
e1c203a165
commit
1e8c811895
@ -59,6 +59,7 @@ Server commands can be run in the server console or in-game. There is a dummy us
|
||||
/gender {male | female}. Sets the player gender.
|
||||
/give [item id] x[amount]. Gives the targetted player an item.
|
||||
/giveall {materials | avatars}. Gives the targeted player items.
|
||||
/help. Displays a list of available commands.
|
||||
/mail [content]. Sends the targeted player a system mail.
|
||||
/permission {add | remove | clear} [permission]. Gives/removes a permission from the targeted player.
|
||||
/reload. Reloads the server config.
|
||||
|
@ -0,0 +1,26 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
|
||||
@Command(label = "help", permission = "player.help", desc = "/help. Displays a list of available commands.")
|
||||
public class HelpCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
StringBuilder help = new StringBuilder();
|
||||
this.sendMessage(sender, "Displaying list of commands:");
|
||||
|
||||
var labels = LunarCore.getCommandManager().getLabels().keySet().stream().sorted().toList();
|
||||
for (var label : labels) {
|
||||
Command command = LunarCore.getCommandManager().getLabels().get(label).getClass().getAnnotation(Command.class);
|
||||
if (command == null) continue;
|
||||
|
||||
this.sendMessage(sender, command.desc());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user