mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-24 00:11:31 +00:00
Add command description multilingual
This commit is contained in:
parent
b69c58cab1
commit
05e1e5502c
@ -9,8 +9,6 @@ public @interface Command {
|
|||||||
|
|
||||||
String usage() default "No usage specified";
|
String usage() default "No usage specified";
|
||||||
|
|
||||||
String description() default "No description specified";
|
|
||||||
|
|
||||||
String[] aliases() default {};
|
String[] aliases() default {};
|
||||||
|
|
||||||
String permission() default "";
|
String permission() default "";
|
||||||
|
@ -6,6 +6,9 @@ import emu.grasscutter.game.player.Player;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface CommandHandler {
|
public interface CommandHandler {
|
||||||
|
|
||||||
|
String description();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to the target.
|
* Send a message to the target.
|
||||||
*
|
*
|
||||||
|
@ -85,6 +85,14 @@ public final class CommandMap {
|
|||||||
return new LinkedHashMap<>(this.annotations);
|
return new LinkedHashMap<>(this.annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<CommandHandler, Command> getHandlersAndAnnotations() {
|
||||||
|
HashMap<CommandHandler, Command> hashMap = new HashMap<>();
|
||||||
|
this.commands.forEach((key, handler) -> {
|
||||||
|
hashMap.put(handler, this.annotations.get(key));
|
||||||
|
});
|
||||||
|
return hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all registered commands.
|
* Returns a list of all registered commands.
|
||||||
*
|
*
|
||||||
|
@ -9,9 +9,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "account", usage = "account <create|delete> <username> [uid]", description = "Modify user accounts")
|
@Command(label = "account", usage = "account <create|delete> <username> [uid]")
|
||||||
public final class AccountCommand implements CommandHandler {
|
public final class AccountCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.account.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (sender != null) {
|
if (sender != null) {
|
||||||
|
@ -9,10 +9,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "broadcast", usage = "broadcast <message>",
|
@Command(label = "broadcast", usage = "broadcast <message>", aliases = {"b"}, permission = "server.broadcast")
|
||||||
description = "Sends a message to all the players", aliases = {"b"}, permission = "server.broadcast")
|
|
||||||
public final class BroadcastCommand implements CommandHandler {
|
public final class BroadcastCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.broadcast.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (args.size() < 1) {
|
if (args.size() < 1) {
|
||||||
|
@ -8,9 +8,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "changescene", usage = "changescene <scene id>",
|
@Command(label = "changescene", usage = "changescene <scene id>", aliases = {"scene"}, permission = "player.changescene")
|
||||||
description = "Changes your scene", aliases = {"scene"}, permission = "player.changescene")
|
|
||||||
public final class ChangeSceneCommand implements CommandHandler {
|
public final class ChangeSceneCommand implements CommandHandler {
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.changescene.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -13,11 +13,15 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "clear", usage = "clear <all|wp|art|mat>", //Merged /clearartifacts and /clearweapons to /clear <args> [uid]
|
@Command(label = "clear", usage = "clear <all|wp|art|mat>", //Merged /clearartifacts and /clearweapons to /clear <args> [uid]
|
||||||
description = "Deletes unequipped unlocked items, including yellow rarity ones from your inventory",
|
|
||||||
aliases = {"clear"}, permission = "player.clearinv")
|
aliases = {"clear"}, permission = "player.clearinv")
|
||||||
|
|
||||||
public final class ClearCommand implements CommandHandler {
|
public final class ClearCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.clear.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -9,9 +9,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "coop", usage = "coop [host UID]",
|
@Command(label = "coop", usage = "coop [host UID]", permission = "server.coop")
|
||||||
description = "Forces someone to join the world of others", permission = "server.coop")
|
|
||||||
public final class CoopCommand implements CommandHandler {
|
public final class CoopCommand implements CommandHandler {
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.coop.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -13,10 +13,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "drop", usage = "drop <itemId|itemName> [amount]",
|
@Command(label = "drop", usage = "drop <itemId|itemName> [amount]", aliases = {"d", "dropitem"}, permission = "server.drop")
|
||||||
description = "Drops an item near you", aliases = {"d", "dropitem"}, permission = "server.drop")
|
|
||||||
public final class DropCommand implements CommandHandler {
|
public final class DropCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.drop.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -8,9 +8,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "enterdungeon", usage = "enterdungeon <dungeon id>",
|
@Command(label = "enterdungeon", usage = "enterdungeon <dungeon id>", aliases = {"dungeon"}, permission = "player.enterdungeon")
|
||||||
description = "Enter a dungeon", aliases = {"dungeon"}, permission = "player.enterdungeon")
|
|
||||||
public final class EnterDungeonCommand implements CommandHandler {
|
public final class EnterDungeonCommand implements CommandHandler {
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.enter_dungeon.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -15,10 +15,14 @@ import java.util.*;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "giveall", usage = "giveall [amount]",
|
@Command(label = "giveall", usage = "giveall [amount]", aliases = {"givea"}, permission = "player.giveall", threading = true)
|
||||||
description = "Gives all items", aliases = {"givea"}, permission = "player.giveall", threading = true)
|
|
||||||
public final class GiveAllCommand implements CommandHandler {
|
public final class GiveAllCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.giveAll.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -16,8 +16,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "giveart", usage = "giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", description = "Gives the player a specified artifact", aliases = {"gart"}, permission = "player.giveart")
|
@Command(label = "giveart", usage = "giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", aliases = {"gart"}, permission = "player.giveart")
|
||||||
public final class GiveArtifactCommand implements CommandHandler {
|
public final class GiveArtifactCommand implements CommandHandler {
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.giveArtifact.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -12,10 +12,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "givechar", usage = "givechar <avatarId> [level]",
|
@Command(label = "givechar", usage = "givechar <avatarId> [level]", aliases = {"givec"}, permission = "player.givechar")
|
||||||
description = "Gives the player a specified character", aliases = {"givec"}, permission = "player.givechar")
|
|
||||||
public final class GiveCharCommand implements CommandHandler {
|
public final class GiveCharCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.giveChar.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package emu.grasscutter.command.commands;
|
package emu.grasscutter.command.commands;
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
|
||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
@ -12,12 +11,12 @@ import emu.grasscutter.game.props.ActionReason;
|
|||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "give", usage = "give <itemId|itemName> [amount] [level]", description = "Gives an item to you or the specified player", aliases = {
|
@Command(label = "give", usage = "give <itemId|itemName> [amount] [level]", aliases = {
|
||||||
"g", "item", "giveitem"}, permission = "player.give")
|
"g", "item", "giveitem"}, permission = "player.give")
|
||||||
public final class GiveCommand implements CommandHandler {
|
public final class GiveCommand implements CommandHandler {
|
||||||
Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals
|
Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals
|
||||||
@ -32,6 +31,11 @@ public final class GiveCommand implements CommandHandler {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.give.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package emu.grasscutter.command.commands;
|
package emu.grasscutter.command.commands;
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
|
||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
@ -9,10 +8,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "godmode", usage = "godmode [on|off|toggle]",
|
@Command(label = "godmode", usage = "godmode [on|off|toggle]", permission = "player.godmode")
|
||||||
description = "Prevents you from taking damage. Defaults to toggle.", permission = "player.godmode")
|
|
||||||
public final class GodModeCommand implements CommandHandler {
|
public final class GodModeCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.godmode.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -11,9 +11,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "heal", usage = "heal|h", aliases = {"h"},
|
@Command(label = "heal", usage = "heal|h", aliases = {"h"}, permission = "player.heal")
|
||||||
description = "Heal all characters in your current team.", permission = "player.heal")
|
|
||||||
public final class HealCommand implements CommandHandler {
|
public final class HealCommand implements CommandHandler {
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.heal.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -10,22 +10,26 @@ import java.util.*;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "help", usage = "help [command]",
|
@Command(label = "help", usage = "help [command]")
|
||||||
description = "Sends the help message or shows information about a specified command")
|
|
||||||
public final class HelpCommand implements CommandHandler {
|
public final class HelpCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.help.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player player, Player targetPlayer, List<String> args) {
|
public void execute(Player player, Player targetPlayer, List<String> args) {
|
||||||
if (args.size() < 1) {
|
if (args.size() < 1) {
|
||||||
HashMap<String, CommandHandler> handlers = CommandMap.getInstance().getHandlers();
|
HashMap<String, CommandHandler> handlers = CommandMap.getInstance().getHandlers();
|
||||||
List<Command> annotations = new ArrayList<>();
|
HashMap<Command, CommandHandler> annotations = new HashMap<>();
|
||||||
for (String key : handlers.keySet()) {
|
for (String key : handlers.keySet()) {
|
||||||
Command annotation = handlers.get(key).getClass().getAnnotation(Command.class);
|
Command annotation = handlers.get(key).getClass().getAnnotation(Command.class);
|
||||||
|
|
||||||
if (!Arrays.asList(annotation.aliases()).contains(key)) {
|
if (!Arrays.asList(annotation.aliases()).contains(key)) {
|
||||||
if (player != null && !Objects.equals(annotation.permission(), "") && !player.getAccount().hasPermission(annotation.permission()))
|
if (player != null && !Objects.equals(annotation.permission(), "") && !player.getAccount().hasPermission(annotation.permission()))
|
||||||
continue;
|
continue;
|
||||||
annotations.add(annotation);
|
annotations.put(annotation, handlers.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +43,7 @@ public final class HelpCommand implements CommandHandler {
|
|||||||
} else {
|
} else {
|
||||||
Command annotation = handler.getClass().getAnnotation(Command.class);
|
Command annotation = handler.getClass().getAnnotation(Command.class);
|
||||||
|
|
||||||
builder.append(" ").append(annotation.description()).append("\n");
|
builder.append(" ").append(handler.description()).append("\n");
|
||||||
builder.append(translate("commands.help.usage")).append(annotation.usage());
|
builder.append(translate("commands.help.usage")).append(annotation.usage());
|
||||||
if (annotation.aliases().length >= 1) {
|
if (annotation.aliases().length >= 1) {
|
||||||
builder.append("\n").append(translate("commands.help.aliases"));
|
builder.append("\n").append(translate("commands.help.aliases"));
|
||||||
@ -56,12 +60,12 @@ public final class HelpCommand implements CommandHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendAllHelpMessage(Player player, List<Command> annotations) {
|
void SendAllHelpMessage(Player player, HashMap<Command, CommandHandler> annotations) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
StringBuilder builder = new StringBuilder("\n" + translate("commands.help.available_commands") + "\n");
|
StringBuilder builder = new StringBuilder("\n" + translate("commands.help.available_commands") + "\n");
|
||||||
annotations.forEach(annotation -> {
|
annotations.forEach((annotation, handler) -> {
|
||||||
builder.append(annotation.label()).append("\n");
|
builder.append(annotation.label()).append("\n");
|
||||||
builder.append(" ").append(annotation.description()).append("\n");
|
builder.append(" ").append(handler.description()).append("\n");
|
||||||
builder.append(translate("commands.help.usage")).append(annotation.usage());
|
builder.append(translate("commands.help.usage")).append(annotation.usage());
|
||||||
if (annotation.aliases().length >= 1) {
|
if (annotation.aliases().length >= 1) {
|
||||||
builder.append("\n").append(translate("commands.help.aliases"));
|
builder.append("\n").append(translate("commands.help.aliases"));
|
||||||
@ -76,9 +80,9 @@ public final class HelpCommand implements CommandHandler {
|
|||||||
CommandHandler.sendMessage(null, builder.toString());
|
CommandHandler.sendMessage(null, builder.toString());
|
||||||
} else {
|
} else {
|
||||||
CommandHandler.sendMessage(player, translate("commands.help.available_commands"));
|
CommandHandler.sendMessage(player, translate("commands.help.available_commands"));
|
||||||
annotations.forEach(annotation -> {
|
annotations.forEach((annotation, handler) -> {
|
||||||
StringBuilder builder = new StringBuilder(annotation.label()).append("\n");
|
StringBuilder builder = new StringBuilder(annotation.label()).append("\n");
|
||||||
builder.append(" ").append(annotation.description()).append("\n");
|
builder.append(" ").append(handler.description()).append("\n");
|
||||||
builder.append(translate("commands.help.usage")).append(annotation.usage());
|
builder.append(translate("commands.help.usage")).append(annotation.usage());
|
||||||
if (annotation.aliases().length >= 1) {
|
if (annotation.aliases().length >= 1) {
|
||||||
builder.append("\n").append(translate("commands.help.aliases"));
|
builder.append("\n").append(translate("commands.help.aliases"));
|
||||||
|
@ -8,10 +8,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "kick", usage = "kick",
|
@Command(label = "kick", usage = "kick", permission = "server.kick")
|
||||||
description = "Kicks the specified player from the server (WIP)", permission = "server.kick")
|
|
||||||
public final class KickCommand implements CommandHandler {
|
public final class KickCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.kick.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -12,10 +12,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "killall", usage = "killall [sceneId]",
|
@Command(label = "killall", usage = "killall [sceneId]", permission = "server.killall")
|
||||||
description = "Kill all entities", permission = "server.killall")
|
|
||||||
public final class KillAllCommand implements CommandHandler {
|
public final class KillAllCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.kill.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -13,10 +13,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "killcharacter", usage = "killcharacter", aliases = {"suicide", "kill"},
|
@Command(label = "killcharacter", usage = "killcharacter", aliases = {"suicide", "kill"}, permission = "player.killcharacter")
|
||||||
description = "Kills the players current character", permission = "player.killcharacter")
|
|
||||||
public final class KillCharacterCommand implements CommandHandler {
|
public final class KillCharacterCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.killCharacter.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -10,10 +10,14 @@ import java.util.Map;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "list", usage = "list [uid]",
|
@Command(label = "list", usage = "list [uid]", aliases = {"players"})
|
||||||
description = "List online players", aliases = {"players"})
|
|
||||||
public final class ListCommand implements CommandHandler {
|
public final class ListCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.list.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
Map<Integer, Player> playersMap = Grasscutter.getGameServer().getPlayers();
|
Map<Integer, Player> playersMap = Grasscutter.getGameServer().getPlayers();
|
||||||
|
@ -10,10 +10,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "permission", usage = "permission <add|remove> <permission>",
|
@Command(label = "permission", usage = "permission <add|remove> <permission>", permission = "*")
|
||||||
description = "Grants or removes a permission for a user", permission = "*")
|
|
||||||
public final class PermissionCommand implements CommandHandler {
|
public final class PermissionCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.permission.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -9,10 +9,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "position", usage = "position", aliases = {"pos"},
|
@Command(label = "position", usage = "position", aliases = {"pos"})
|
||||||
description = "Get coordinates.")
|
|
||||||
public final class PositionCommand implements CommandHandler {
|
public final class PositionCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.position.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -9,10 +9,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "reload", usage = "reload",
|
@Command(label = "reload", usage = "reload", permission = "server.reload")
|
||||||
description = "Reload server config", permission = "server.reload")
|
|
||||||
public final class ReloadCommand implements CommandHandler {
|
public final class ReloadCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.reload.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
CommandHandler.sendMessage(sender, translate("commands.reload.reload_start"));
|
CommandHandler.sendMessage(sender, translate("commands.reload.reload_start"));
|
||||||
|
@ -11,10 +11,14 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "resetconst", usage = "resetconst [all]",
|
@Command(label = "resetconst", usage = "resetconst [all]",
|
||||||
description = "Resets the constellation level on your current active character, will need to relog after using the command to see any changes.",
|
|
||||||
aliases = {"resetconstellation"}, permission = "player.resetconstellation")
|
aliases = {"resetconstellation"}, permission = "player.resetconstellation")
|
||||||
public final class ResetConstCommand implements CommandHandler {
|
public final class ResetConstCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.resetConst.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -9,9 +9,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "resetshop", usage = "resetshop",
|
@Command(label = "resetshop", usage = "resetshop", permission = "server.resetshop")
|
||||||
description = "Reset target player's shop refresh time.", permission = "server.resetshop")
|
|
||||||
public final class ResetShopLimitCommand implements CommandHandler {
|
public final class ResetShopLimitCommand implements CommandHandler {
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.status.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -6,9 +6,16 @@ import emu.grasscutter.game.player.Player;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Command(label = "restart", usage = "restart - Restarts the current session")
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
|
@Command(label = "restart", usage = "restart")
|
||||||
public final class RestartCommand implements CommandHandler {
|
public final class RestartCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.restart.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (sender == null) {
|
if (sender == null) {
|
||||||
|
@ -13,8 +13,7 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
@Command(label = "sendmail", usage = "sendmail <userId|all|help> [templateId]",
|
@Command(label = "sendmail", usage = "sendmail <userId|all|help> [templateId]", permission = "server.sendmail")
|
||||||
description = "Sends mail to the specified user. The usage of this command changes based on it's composition state.", permission = "server.sendmail")
|
|
||||||
public final class SendMailCommand implements CommandHandler {
|
public final class SendMailCommand implements CommandHandler {
|
||||||
|
|
||||||
// TODO: You should be able to do /sendmail and then just send subsequent messages until you finish
|
// TODO: You should be able to do /sendmail and then just send subsequent messages until you finish
|
||||||
@ -24,6 +23,11 @@ public final class SendMailCommand implements CommandHandler {
|
|||||||
// Key = User that is constructing the mail.
|
// Key = User that is constructing the mail.
|
||||||
private static final HashMap<Integer, MailBuilder> mailBeingConstructed = new HashMap<Integer, MailBuilder>();
|
private static final HashMap<Integer, MailBuilder> mailBeingConstructed = new HashMap<Integer, MailBuilder>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.sendMail.description");
|
||||||
|
}
|
||||||
|
|
||||||
// Yes this is awful and I hate it.
|
// Yes this is awful and I hate it.
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
@ -40,7 +44,7 @@ public final class SendMailCommand implements CommandHandler {
|
|||||||
MailBuilder mailBuilder;
|
MailBuilder mailBuilder;
|
||||||
switch (args.get(0).toLowerCase()) {
|
switch (args.get(0).toLowerCase()) {
|
||||||
case "help" -> {
|
case "help" -> {
|
||||||
CommandHandler.sendMessage(sender, this.getClass().getAnnotation(Command.class).description() + "\nUsage: " + this.getClass().getAnnotation(Command.class).usage());
|
CommandHandler.sendMessage(sender, this.description() + "\nUsage: " + this.getClass().getAnnotation(Command.class).usage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case "all" -> mailBuilder = new MailBuilder(true, new Mail());
|
case "all" -> mailBuilder = new MailBuilder(true, new Mail());
|
||||||
|
@ -8,10 +8,15 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "say", usage = "say <message>", description = "Sends a message to a player as the server",
|
@Command(label = "say", usage = "say <message>",
|
||||||
aliases = {"sendservmsg", "sendservermessage", "sendmessage"}, permission = "server.sendmessage")
|
aliases = {"sendservmsg", "sendservermessage", "sendmessage"}, permission = "server.sendmessage")
|
||||||
public final class SendMessageCommand implements CommandHandler {
|
public final class SendMessageCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.sendMessage.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -12,10 +12,14 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "setfetterlevel", usage = "setfetterlevel <level>",
|
@Command(label = "setfetterlevel", usage = "setfetterlevel <level>",
|
||||||
description = "Sets your fetter level for your current active character",
|
|
||||||
aliases = {"setfetterlvl", "setfriendship"}, permission = "player.setfetterlevel")
|
aliases = {"setfetterlvl", "setfriendship"}, permission = "player.setfetterlevel")
|
||||||
public final class SetFetterLevelCommand implements CommandHandler {
|
public final class SetFetterLevelCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.setFetterLevel.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -15,8 +15,7 @@ import emu.grasscutter.utils.Language;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "setstats", usage = "setstats|stats <stat> <value>",
|
@Command(label = "setstats", usage = "setstats|stats <stat> <value>", aliases = {"stats"}, permission = "player.setstats")
|
||||||
description = "Set fight property for your current active character", aliases = {"stats"}, permission = "player.setstats")
|
|
||||||
public final class SetStatsCommand implements CommandHandler {
|
public final class SetStatsCommand implements CommandHandler {
|
||||||
static class Stat {
|
static class Stat {
|
||||||
String name;
|
String name;
|
||||||
@ -174,6 +173,11 @@ public final class SetStatsCommand implements CommandHandler {
|
|||||||
stats.put("_nonextra_physical_add_hurt", new Stat("NONEXTRA_PHYSICAL_ADD_HURT", FightProperty.FIGHT_PROP_NONEXTRA_PHYSICAL_ADD_HURT, true));
|
stats.put("_nonextra_physical_add_hurt", new Stat("NONEXTRA_PHYSICAL_ADD_HURT", FightProperty.FIGHT_PROP_NONEXTRA_PHYSICAL_ADD_HURT, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.setStats.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
String syntax = sender == null ? translate("commands.setStats.usage_console") : translate("commands.setStats.ingame");
|
String syntax = sender == null ? translate("commands.setStats.usage_console") : translate("commands.setStats.ingame");
|
||||||
|
@ -10,10 +10,14 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "setworldlevel", usage = "setworldlevel <level>",
|
@Command(label = "setworldlevel", usage = "setworldlevel <level>",
|
||||||
description = "Sets your world level (Relog to see proper effects)",
|
|
||||||
aliases = {"setworldlvl"}, permission = "player.setworldlevel")
|
aliases = {"setworldlvl"}, permission = "player.setworldlevel")
|
||||||
public final class SetWorldLevelCommand implements CommandHandler {
|
public final class SetWorldLevelCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.setWorldLevel.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -22,10 +22,14 @@ import java.util.Random;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "spawn", usage = "spawn <entityId> [amount] [level(monster only)]",
|
@Command(label = "spawn", usage = "spawn <entityId> [amount] [level(monster only)]", permission = "server.spawn")
|
||||||
description = "Spawns an entity near you", permission = "server.spawn")
|
|
||||||
public final class SpawnCommand implements CommandHandler {
|
public final class SpawnCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.spawn.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -9,10 +9,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "stop", usage = "stop",
|
@Command(label = "stop", usage = "stop", permission = "server.stop")
|
||||||
description = "Stops the server", permission = "server.stop")
|
|
||||||
public final class StopCommand implements CommandHandler {
|
public final class StopCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.stop.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
CommandHandler.sendMessage(null, translate("commands.stop.success"));
|
CommandHandler.sendMessage(null, translate("commands.stop.success"));
|
||||||
|
@ -14,8 +14,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "talent", usage = "talent <talentID> <value>",
|
@Command(label = "talent", usage = "talent <talentID> <value>", permission = "player.settalent")
|
||||||
description = "Set talent level for your current active character", permission = "player.settalent")
|
|
||||||
public final class TalentCommand implements CommandHandler {
|
public final class TalentCommand implements CommandHandler {
|
||||||
private void setTalentLevel(Player sender, Player player, Avatar avatar, int talentId, int talentLevel) {
|
private void setTalentLevel(Player sender, Player player, Avatar avatar, int talentId, int talentLevel) {
|
||||||
int oldLevel = avatar.getSkillLevelMap().get(talentId);
|
int oldLevel = avatar.getSkillLevelMap().get(talentId);
|
||||||
@ -44,6 +43,11 @@ public final class TalentCommand implements CommandHandler {
|
|||||||
CommandHandler.sendMessage(sender, translate(successMessage, talentLevel));
|
CommandHandler.sendMessage(sender, translate(successMessage, talentLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.talent.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -10,9 +10,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "tpall", usage = "tpall",
|
@Command(label = "tpall", usage = "tpall", permission = "player.tpall")
|
||||||
description = "Teleports all players in your world to your position", permission = "player.tpall")
|
|
||||||
public final class TeleportAllCommand implements CommandHandler {
|
public final class TeleportAllCommand implements CommandHandler {
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.teleportAll.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -10,8 +10,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "teleport", usage = "teleport <x> <y> <z> [scene id]", aliases = {"tp"},
|
@Command(label = "teleport", usage = "teleport <x> <y> <z> [scene id]", aliases = {"tp"}, permission = "player.teleport")
|
||||||
description = "Change the player's position.", permission = "player.teleport")
|
|
||||||
public final class TeleportCommand implements CommandHandler {
|
public final class TeleportCommand implements CommandHandler {
|
||||||
|
|
||||||
private float parseRelative(String input, Float current) { // TODO: Maybe this will be useful elsewhere later
|
private float parseRelative(String input, Float current) { // TODO: Maybe this will be useful elsewhere later
|
||||||
@ -25,6 +24,11 @@ public final class TeleportCommand implements CommandHandler {
|
|||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.teleport.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -11,10 +11,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "weather", usage = "weather <weatherId> [climateId]",
|
@Command(label = "weather", usage = "weather <weatherId> [climateId]", aliases = {"w"}, permission = "player.weather")
|
||||||
description = "Changes the weather.", aliases = {"w"}, permission = "player.weather")
|
|
||||||
public final class WeatherCommand implements CommandHandler {
|
public final class WeatherCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return translate("commands.weather.description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -21,6 +21,7 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
import emu.grasscutter.GameConstants;
|
import emu.grasscutter.GameConstants;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.Command;
|
||||||
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.command.CommandMap;
|
import emu.grasscutter.command.CommandMap;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.ResourceLoader;
|
import emu.grasscutter.data.ResourceLoader;
|
||||||
@ -112,17 +113,16 @@ final class ToolsWithLanguageOption {
|
|||||||
writer.println("// Created " + dtf.format(now) + System.lineSeparator() + System.lineSeparator());
|
writer.println("// Created " + dtf.format(now) + System.lineSeparator() + System.lineSeparator());
|
||||||
|
|
||||||
CommandMap cmdMap = new CommandMap(true);
|
CommandMap cmdMap = new CommandMap(true);
|
||||||
List<Command> cmdList = new ArrayList<>(cmdMap.getAnnotationsAsList());
|
HashMap<CommandHandler, Command> cmdList = cmdMap.getHandlersAndAnnotations();
|
||||||
|
|
||||||
writer.println("// Commands");
|
writer.println("// Commands");
|
||||||
for (Command cmd : cmdList) {
|
cmdList.forEach((handler, command) -> {
|
||||||
String cmdName = cmd.label();
|
String cmdName = command.label();
|
||||||
while (cmdName.length() <= 15) {
|
while (cmdName.length() <= 15) {
|
||||||
cmdName = " " + cmdName;
|
cmdName = " " + cmdName;
|
||||||
}
|
}
|
||||||
writer.println(cmdName + " : " + cmd.description());
|
writer.println(cmdName + " : " + handler.description());
|
||||||
}
|
});
|
||||||
|
|
||||||
writer.println();
|
writer.println();
|
||||||
|
|
||||||
list = new ArrayList<>(GameData.getAvatarDataMap().keySet());
|
list = new ArrayList<>(GameData.getAvatarDataMap().keySet());
|
||||||
|
@ -95,17 +95,20 @@
|
|||||||
"create": "Account created with UID %s.",
|
"create": "Account created with UID %s.",
|
||||||
"delete": "Account deleted.",
|
"delete": "Account deleted.",
|
||||||
"no_account": "Account not found.",
|
"no_account": "Account not found.",
|
||||||
"command_usage": "Usage: account <create|delete> <username> [uid]"
|
"command_usage": "Usage: account <create|delete> <username> [uid]",
|
||||||
|
"description": "Modify user accounts"
|
||||||
},
|
},
|
||||||
"broadcast": {
|
"broadcast": {
|
||||||
"command_usage": "Usage: broadcast <message>",
|
"command_usage": "Usage: broadcast <message>",
|
||||||
"message_sent": "Message sent."
|
"message_sent": "Message sent.",
|
||||||
|
"description": "Sends a message to all the players"
|
||||||
},
|
},
|
||||||
"changescene": {
|
"changescene": {
|
||||||
"usage": "Usage: changescene <sceneId>",
|
"usage": "Usage: changescene <sceneId>",
|
||||||
"already_in_scene": "You are already in that scene.",
|
"already_in_scene": "You are already in that scene.",
|
||||||
"success": "Changed to scene %s.",
|
"success": "Changed to scene %s.",
|
||||||
"exists_error": "The specified scene does not exist."
|
"exists_error": "The specified scene does not exist.",
|
||||||
|
"description": "Changes your scene"
|
||||||
},
|
},
|
||||||
"clear": {
|
"clear": {
|
||||||
"command_usage": "Usage: clear <all|wp|art|mat>",
|
"command_usage": "Usage: clear <all|wp|art|mat>",
|
||||||
@ -115,35 +118,41 @@
|
|||||||
"furniture": "Cleared furniture for %s.",
|
"furniture": "Cleared furniture for %s.",
|
||||||
"displays": "Cleared displays for %s.",
|
"displays": "Cleared displays for %s.",
|
||||||
"virtuals": "Cleared virtuals for %s.",
|
"virtuals": "Cleared virtuals for %s.",
|
||||||
"everything": "Cleared everything for %s."
|
"everything": "Cleared everything for %s.",
|
||||||
|
"description": "Deletes unequipped unlocked items, including yellow rarity ones from your inventory"
|
||||||
},
|
},
|
||||||
"coop": {
|
"coop": {
|
||||||
"usage": "Usage: coop <playerId> <target playerId>",
|
"usage": "Usage: coop <playerId> <target playerId>",
|
||||||
"success": "Summoned %s to %s's world."
|
"success": "Summoned %s to %s's world.",
|
||||||
|
"description": "Forces someone to join the world of others"
|
||||||
},
|
},
|
||||||
"enter_dungeon": {
|
"enter_dungeon": {
|
||||||
"usage": "Usage: enterdungeon <dungeon id>",
|
"usage": "Usage: enterdungeon <dungeon id>",
|
||||||
"changed": "Changed to dungeon %s",
|
"changed": "Changed to dungeon %s",
|
||||||
"not_found_error": "Dungeon does not exist",
|
"not_found_error": "Dungeon does not exist",
|
||||||
"in_dungeon_error": "You are already in that dungeon"
|
"in_dungeon_error": "You are already in that dungeon",
|
||||||
|
"description": "Enter a dungeon"
|
||||||
},
|
},
|
||||||
"giveAll": {
|
"giveAll": {
|
||||||
"usage": "Usage: giveall [player] [amount]",
|
"usage": "Usage: giveall [player] [amount]",
|
||||||
"started": "Receiving all items...",
|
"started": "Receiving all items...",
|
||||||
"success": "Successfully gave all items to %s.",
|
"success": "Successfully gave all items to %s.",
|
||||||
"invalid_amount_or_playerId": "Invalid amount or player ID."
|
"invalid_amount_or_playerId": "Invalid amount or player ID.",
|
||||||
|
"description": "Gives all items"
|
||||||
},
|
},
|
||||||
"giveArtifact": {
|
"giveArtifact": {
|
||||||
"usage": "Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]",
|
"usage": "Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]",
|
||||||
"id_error": "Invalid artifact ID.",
|
"id_error": "Invalid artifact ID.",
|
||||||
"success": "Given %s to %s."
|
"success": "Given %s to %s.",
|
||||||
|
"description": "Gives the player a specified artifact"
|
||||||
},
|
},
|
||||||
"giveChar": {
|
"giveChar": {
|
||||||
"usage": "Usage: givechar <player> <itemId|itemName> [amount]",
|
"usage": "Usage: givechar <player> <itemId|itemName> [amount]",
|
||||||
"given": "Given %s with level %s to %s.",
|
"given": "Given %s with level %s to %s.",
|
||||||
"invalid_avatar_id": "Invalid avatar id.",
|
"invalid_avatar_id": "Invalid avatar id.",
|
||||||
"invalid_avatar_level": "Invalid avatar level.",
|
"invalid_avatar_level": "Invalid avatar level.",
|
||||||
"invalid_avatar_or_player_id": "Invalid avatar or player ID."
|
"invalid_avatar_or_player_id": "Invalid avatar or player ID.",
|
||||||
|
"description": "Gives the player a specified character"
|
||||||
},
|
},
|
||||||
"give": {
|
"give": {
|
||||||
"usage": "Usage: give <player> <itemId|itemName> [amount] [level]",
|
"usage": "Usage: give <player> <itemId|itemName> [amount] [level]",
|
||||||
@ -151,29 +160,36 @@
|
|||||||
"refinement_must_between_1_and_5": "Refinement must be between 1 and 5.",
|
"refinement_must_between_1_and_5": "Refinement must be between 1 and 5.",
|
||||||
"given": "Given %s of %s to %s.",
|
"given": "Given %s of %s to %s.",
|
||||||
"given_with_level_and_refinement": "Given %s with level %s, refinement %s %s times to %s",
|
"given_with_level_and_refinement": "Given %s with level %s, refinement %s %s times to %s",
|
||||||
"given_level": "Given %s with level %s %s times to %s"
|
"given_level": "Given %s with level %s %s times to %s",
|
||||||
|
"description": "Gives an item to you or the specified player"
|
||||||
},
|
},
|
||||||
"godmode": {
|
"godmode": {
|
||||||
"success": "Godmode is now %s for %s."
|
"success": "Godmode is now %s for %s.",
|
||||||
|
"description": "Prevents you from taking damage. Defaults to toggle."
|
||||||
},
|
},
|
||||||
"heal": {
|
"heal": {
|
||||||
"success": "All characters have been healed."
|
"success": "All characters have been healed.",
|
||||||
|
"description": "Heal all characters in your current team."
|
||||||
},
|
},
|
||||||
"kick": {
|
"kick": {
|
||||||
"player_kick_player": "Player [%s:%s] has kicked player [%s:%s]",
|
"player_kick_player": "Player [%s:%s] has kicked player [%s:%s]",
|
||||||
"server_kick_player": "Kicking player [%s:%s]"
|
"server_kick_player": "Kicking player [%s:%s]",
|
||||||
|
"description": "Kicks the specified player from the server (WIP)"
|
||||||
},
|
},
|
||||||
"kill": {
|
"kill": {
|
||||||
"usage": "Usage: killall [playerUid] [sceneId]",
|
"usage": "Usage: killall [playerUid] [sceneId]",
|
||||||
"scene_not_found_in_player_world": "Scene not found in player world",
|
"scene_not_found_in_player_world": "Scene not found in player world",
|
||||||
"kill_monsters_in_scene": "Killing %s monsters in scene %s"
|
"kill_monsters_in_scene": "Killing %s monsters in scene %s",
|
||||||
|
"description": "Kill all entities"
|
||||||
},
|
},
|
||||||
"killCharacter": {
|
"killCharacter": {
|
||||||
"usage": "Usage: /killcharacter [playerId]",
|
"usage": "Usage: /killcharacter [playerId]",
|
||||||
"success": "Killed %s's current character."
|
"success": "Killed %s's current character.",
|
||||||
|
"description": "Kills the players current character"
|
||||||
},
|
},
|
||||||
"list": {
|
"list": {
|
||||||
"success": "There are %s player(s) online:"
|
"success": "There are %s player(s) online:",
|
||||||
|
"description": "List online players"
|
||||||
},
|
},
|
||||||
"permission": {
|
"permission": {
|
||||||
"usage": "Usage: permission <add|remove> <username> <permission>",
|
"usage": "Usage: permission <add|remove> <username> <permission>",
|
||||||
@ -181,21 +197,26 @@
|
|||||||
"has_error": "They already have this permission!",
|
"has_error": "They already have this permission!",
|
||||||
"remove": "Permission removed.",
|
"remove": "Permission removed.",
|
||||||
"not_have_error": "They don't have this permission!",
|
"not_have_error": "They don't have this permission!",
|
||||||
"account_error": "The account cannot be found."
|
"account_error": "The account cannot be found.",
|
||||||
|
"description": "Grants or removes a permission for a user"
|
||||||
},
|
},
|
||||||
"position": {
|
"position": {
|
||||||
"success": "Coordinates: %s, %s, %s\nScene id: %s"
|
"success": "Coordinates: %s, %s, %s\nScene id: %s",
|
||||||
|
"description": "Get coordinates."
|
||||||
},
|
},
|
||||||
"reload": {
|
"reload": {
|
||||||
"reload_start": "Reloading config.",
|
"reload_start": "Reloading config.",
|
||||||
"reload_done": "Reload complete."
|
"reload_done": "Reload complete.",
|
||||||
|
"description": "Reload server config"
|
||||||
},
|
},
|
||||||
"resetConst": {
|
"resetConst": {
|
||||||
"reset_all": "Reset all avatars' constellations.",
|
"reset_all": "Reset all avatars' constellations.",
|
||||||
"success": "Constellations for %s have been reset. Please relog to see changes."
|
"success": "Constellations for %s have been reset. Please relog to see changes.",
|
||||||
|
"description": "Resets the constellation level on your current active character, will need to relog after using the command to see any changes."
|
||||||
},
|
},
|
||||||
"resetShopLimit": {
|
"resetShopLimit": {
|
||||||
"usage": "Usage: /resetshop <player id>"
|
"usage": "Usage: /resetshop <player id>",
|
||||||
|
"description": "Reset target player's shop refresh time."
|
||||||
},
|
},
|
||||||
"sendMail": {
|
"sendMail": {
|
||||||
"usage": "Usage: give [player] <itemId|itemName> [amount]",
|
"usage": "Usage: give [player] <itemId|itemName> [amount]",
|
||||||
@ -217,17 +238,20 @@
|
|||||||
"message": "<message>",
|
"message": "<message>",
|
||||||
"sender": "<sender>",
|
"sender": "<sender>",
|
||||||
"arguments": "<itemId|itemName|finish> [amount] [level]",
|
"arguments": "<itemId|itemName|finish> [amount] [level]",
|
||||||
"error": "ERROR: invalid construction stage %s. Check console for stacktrace."
|
"error": "ERROR: invalid construction stage %s. Check console for stacktrace.",
|
||||||
|
"description": "Sends mail to the specified user. The usage of this command changes based on it's composition state."
|
||||||
},
|
},
|
||||||
"sendMessage": {
|
"sendMessage": {
|
||||||
"usage": "Usage: sendmessage <player> <message>",
|
"usage": "Usage: sendmessage <player> <message>",
|
||||||
"success": "Message sent."
|
"success": "Message sent.",
|
||||||
|
"description": "Sends a message to a player as the server"
|
||||||
},
|
},
|
||||||
"setFetterLevel": {
|
"setFetterLevel": {
|
||||||
"usage": "Usage: setfetterlevel <level>",
|
"usage": "Usage: setfetterlevel <level>",
|
||||||
"range_error": "Fetter level must be between 0 and 10.",
|
"range_error": "Fetter level must be between 0 and 10.",
|
||||||
"success": "Fetter level set to %s",
|
"success": "Fetter level set to %s",
|
||||||
"level_error": "Invalid fetter level."
|
"level_error": "Invalid fetter level.",
|
||||||
|
"description": "Sets your fetter level for your current active character"
|
||||||
},
|
},
|
||||||
"setStats": {
|
"setStats": {
|
||||||
"usage_console": "Usage: setstats|stats @<UID> <stat> <value>",
|
"usage_console": "Usage: setstats|stats @<UID> <stat> <value>",
|
||||||
@ -238,20 +262,24 @@
|
|||||||
"player_error": "Player not found or offline.",
|
"player_error": "Player not found or offline.",
|
||||||
"set_self": "%s set to %s.",
|
"set_self": "%s set to %s.",
|
||||||
"set_for_uid": "%s for %s set to %s.",
|
"set_for_uid": "%s for %s set to %s.",
|
||||||
"set_max_hp": "MAX HP set to %s."
|
"set_max_hp": "MAX HP set to %s.",
|
||||||
|
"description": "Set fight property for your current active character"
|
||||||
},
|
},
|
||||||
"setWorldLevel": {
|
"setWorldLevel": {
|
||||||
"usage": "Usage: setworldlevel <level>",
|
"usage": "Usage: setworldlevel <level>",
|
||||||
"value_error": "World level must be between 0-8",
|
"value_error": "World level must be between 0-8",
|
||||||
"success": "World level set to %s.",
|
"success": "World level set to %s.",
|
||||||
"invalid_world_level": "Invalid world level."
|
"invalid_world_level": "Invalid world level.",
|
||||||
|
"description": "Sets your world level (Relog to see proper effects)"
|
||||||
},
|
},
|
||||||
"spawn": {
|
"spawn": {
|
||||||
"usage": "Usage: spawn <entityId> [amount] [level(monster only)]",
|
"usage": "Usage: spawn <entityId> [amount] [level(monster only)]",
|
||||||
"success": "Spawned %s of %s."
|
"success": "Spawned %s of %s.",
|
||||||
|
"description": "Spawns an entity near you"
|
||||||
},
|
},
|
||||||
"stop": {
|
"stop": {
|
||||||
"success": "Server shutting down..."
|
"success": "Server shutting down...",
|
||||||
|
"description": "Stops the server"
|
||||||
},
|
},
|
||||||
"talent": {
|
"talent": {
|
||||||
"usage_1": "To set talent level: /talent set <talentID> <value>",
|
"usage_1": "To set talent level: /talent set <talentID> <value>",
|
||||||
@ -267,32 +295,41 @@
|
|||||||
"invalid_level": "Invalid talent level.",
|
"invalid_level": "Invalid talent level.",
|
||||||
"normal_attack_id": "Normal Attack ID %s.",
|
"normal_attack_id": "Normal Attack ID %s.",
|
||||||
"e_skill_id": "E skill ID %s.",
|
"e_skill_id": "E skill ID %s.",
|
||||||
"q_skill_id": "Q skill ID %s."
|
"q_skill_id": "Q skill ID %s.",
|
||||||
|
"description": "Set talent level for your current active character"
|
||||||
},
|
},
|
||||||
"teleportAll": {
|
"teleportAll": {
|
||||||
"success": "Summoned all players to your location.",
|
"success": "Summoned all players to your location.",
|
||||||
"error": "You only can use this command in MP mode."
|
"error": "You only can use this command in MP mode.",
|
||||||
|
"description": "Teleports all players in your world to your position"
|
||||||
},
|
},
|
||||||
"teleport": {
|
"teleport": {
|
||||||
"usage_server": "Usage: /tp @<player id> <x> <y> <z> [scene id]",
|
"usage_server": "Usage: /tp @<player id> <x> <y> <z> [scene id]",
|
||||||
"usage": "Usage: /tp [@<player id>] <x> <y> <z> [scene id]",
|
"usage": "Usage: /tp [@<player id>] <x> <y> <z> [scene id]",
|
||||||
"specify_player_id": "You must specify a player id.",
|
"specify_player_id": "You must specify a player id.",
|
||||||
"invalid_position": "Invalid position.",
|
"invalid_position": "Invalid position.",
|
||||||
"success": "Teleported %s to %s, %s, %s in scene %s"
|
"success": "Teleported %s to %s, %s, %s in scene %s",
|
||||||
|
"description": "Change the player's position."
|
||||||
},
|
},
|
||||||
"weather": {
|
"weather": {
|
||||||
"usage": "Usage: weather <weatherId> [climateId]",
|
"usage": "Usage: weather <weatherId> [climateId]",
|
||||||
"success": "Changed weather to %s with climate %s",
|
"success": "Changed weather to %s with climate %s",
|
||||||
"invalid_id": "Invalid ID."
|
"invalid_id": "Invalid ID.",
|
||||||
|
"description": "Changes the weather."
|
||||||
},
|
},
|
||||||
"drop": {
|
"drop": {
|
||||||
"command_usage": "Usage: drop <itemId|itemName> [amount]",
|
"command_usage": "Usage: drop <itemId|itemName> [amount]",
|
||||||
"success": "Dropped %s of %s."
|
"success": "Dropped %s of %s.",
|
||||||
|
"description": "Drops an item near you"
|
||||||
},
|
},
|
||||||
"help": {
|
"help": {
|
||||||
"usage": "Usage: ",
|
"usage": "Usage: ",
|
||||||
"aliases": "Aliases: ",
|
"aliases": "Aliases: ",
|
||||||
"available_commands": "Available commands: "
|
"available_commands": "Available commands: ",
|
||||||
|
"description": "Sends the help message or shows information about a specified command"
|
||||||
|
},
|
||||||
|
"restart": {
|
||||||
|
"description": "Restarts the current session"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user