Skip to content

Commit 61d33af

Browse files
committed
move command / to config rather than code
1 parent 4a55129 commit 61d33af

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/main/java/pro/cloudnode/smp/smpcore/command/MainCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static boolean reload(final @NotNull CommandSender sender) {
105105
public static boolean alt(final @NotNull CommandSender sender, final @NotNull String @NotNull [] originalArgs, final @NotNull String label) {
106106
if (!sender.hasPermission(Permission.ALT)) return sendMessage(sender, SMPCore.messages().errorNoPermission());
107107

108-
final @NotNull String command = "/" + label;
108+
final @NotNull String command = label;
109109

110110
final @NotNull TextComponent.Builder subCommandBuilder = Component.text()
111111
.append(SMPCore.messages().subCommandHeader("Alt", command + " ...")).append(Component.newline())

src/main/java/pro/cloudnode/smp/smpcore/command/NationCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static boolean helpSubCommands(
7777
) {
7878
final boolean other = member == null || nation == null || !nation.id.equals(member.nationID);
7979

80-
final @NotNull String command = "/" + label + (other && nation != null ? " id:" + nation.id : "");
80+
final @NotNull String command = label + (other && nation != null ? " id:" + nation.id : "");
8181
final @NotNull TextComponent.Builder subCommandBuilder = Component.text()
8282
.append(SMPCore.messages()
8383
.subCommandHeader(
@@ -122,15 +122,15 @@ public static boolean citizens(
122122
return sendMessage(sender, SMPCore.messages().errorNotCitizen());
123123

124124
if (args.length == 0)
125-
return citizensSubcommands(member, nation, sender, "/" + label);
125+
return citizensSubcommands(member, nation, sender, label);
126126
final @NotNull String command = label + " " + args[0];
127127
final @NotNull String @NotNull [] argsSubset = Arrays.copyOfRange(args, 1, args.length);
128128
return switch (args[0]) {
129129
case "list", "show", "get" -> listCitizens(member, nation, sender);
130130
case "kick", "remove", "delete", "rm", "del" -> kickCitizen(member, nation, sender, command, argsSubset);
131131
case "invite", "request", "req" -> inviteCitizen(member, nation, sender, command, argsSubset);
132132
case "add" -> addCitizen(member, nation, sender, command, argsSubset);
133-
default -> citizensSubcommands(member, nation, sender, "/" + label);
133+
default -> citizensSubcommands(member, nation, sender, label);
134134
};
135135
}
136136

src/main/resources/messages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ unbanned-player: <yellow>(!) Unbanned singular non-member player <gray><player><
99
unbanned-member: <green>(!) Unbanned member <gray><player></gray> and <gray><n-alts></gray> alts.</green>
1010

1111
subcommands:
12-
header: <green><name> Sub Commands:</green> <gray>(<usage>)</gray>
13-
entry: <click:suggest_command:"<command>"><dark_gray>></dark_gray> <white><label></white><gray><args></gray></click>
14-
entry-with-description: <click:suggest_command:"<command>"><dark_gray>></dark_gray> <white><label></white><gray><args></gray> <dark_gray>-</dark_gray> <gray><description></gray></click>
12+
header: <green><name> Sub Commands:</green> <gray>(/<usage>)</gray>
13+
entry: <click:suggest_command:"/<command>"><dark_gray>></dark_gray> <white><label></white><gray><args></gray></click>
14+
entry-with-description: <click:suggest_command:"/<command>"><dark_gray>></dark_gray> <white><label></white><gray><args></gray> <dark_gray>-</dark_gray> <gray><description></gray></click>
1515
argument:
1616
required: <dark_gray><</dark_gray><arg><dark_gray>></dark_gray>
1717
optional: <dark_gray>[</dark_gray><arg><dark_gray>]</dark_gray>

0 commit comments

Comments
 (0)