Improve message formatting to clients

Replaces tab indents with an extra linebreak.
Also adds / to the start of command usage.
Neither of these changes affect messages to the server console log.
This commit is contained in:
AnimeGitB 2022-07-28 12:15:58 +09:30 committed by Melledy
parent 24dfac65b2
commit 0fa3d0e8d1

View File

@ -28,7 +28,7 @@ public interface CommandHandler {
if (player == null) { if (player == null) {
Grasscutter.getLogger().info(event.getMessage()); Grasscutter.getLogger().info(event.getMessage());
} else { } else {
player.dropMessage(event.getMessage()); player.dropMessage(event.getMessage().replace("\n\t", "\n\n"));
} }
} }
@ -44,6 +44,9 @@ public interface CommandHandler {
if (alias.length() < command.length()) if (alias.length() < command.length())
command = alias; command = alias;
} }
if (player != null) {
command = "/" + command;
}
String target = switch (annotation.targetRequirement()) { String target = switch (annotation.targetRequirement()) {
case NONE -> ""; case NONE -> "";
case OFFLINE -> "@<UID> "; // TODO: make translation keys for offline and online players case OFFLINE -> "@<UID> "; // TODO: make translation keys for offline and online players