Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Commands: add tab complete locale reason
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Aug 14, 2023
1 parent 69d1fbd commit 1fc66cd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/flectone/commands/CommandMute.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull
switch (strings.length){
case 1 -> isOfflinePlayer(strings[0]);
case 2 -> isFormatString(strings[1]);
case 3 -> isStartsWith(strings[2], "(reason)");
case 3 -> isTabCompleteMessage(strings[2], "tab-complete.reason");
}

Collections.sort(wordsList);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/flectone/commands/CommandTempban.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull
isStartsWith(strings[1], "permanent");
isStartsWith(strings[1], "0");
}
case 3 -> isStartsWith(strings[2], "(reason)");
case 3 -> isTabCompleteMessage(strings[2], "tab-complete.reason");
}

Collections.sort(wordsList);
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/net/flectone/misc/commands/FTabCompleter.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ default void isFormatString(@NotNull String arg) {
}

default void isTabCompleteMessage(@NotNull String arg) {
isStartsWith(arg, FileManager.locale.getString("tab-complete.message"));
isTabCompleteMessage(arg, "tab-complete.message");
}

default void isTabCompleteMessage(String arg, String localeKey) {
isStartsWith(arg, FileManager.locale.getString(localeKey));
}

default void isDigitInArray(String arg, String string, int start, int end) {
for (int x = start; x < end; x++) {
isStartsWith(arg, x + string);
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/language/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ chat:

tab-complete:
message: "(message)"
reason: "(reason)"

command:
null-player: "#ff4e4e⁉ This player does not exist"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/language/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ chat:

tab-complete:
message: "(сообщение)"
reason: "(причина)"

command:
null-player: "#ff4e4e⁉ Этот игрок не существует"
Expand Down

0 comments on commit 1fc66cd

Please sign in to comment.