mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-17 03:44:05 +08:00
refactor: replace concatenation log with parameterized
This commit is contained in:
@@ -53,7 +53,7 @@ public final class CommandMap {
|
||||
* @return Instance chaining.
|
||||
*/
|
||||
public CommandMap registerCommand(String label, CommandHandler command) {
|
||||
Grasscutter.getLogger().trace("Registered command: " + label);
|
||||
Grasscutter.getLogger().trace("Registered command: {}", label);
|
||||
label = label.toLowerCase();
|
||||
|
||||
// Get command data.
|
||||
@@ -76,7 +76,7 @@ public final class CommandMap {
|
||||
* @return Instance chaining.
|
||||
*/
|
||||
public CommandMap unregisterCommand(String label) {
|
||||
Grasscutter.getLogger().trace("Un-registered command: " + label);
|
||||
Grasscutter.getLogger().trace("Un-registered command: {}", label);
|
||||
|
||||
CommandHandler handler = this.commands.get(label);
|
||||
if (handler == null) return this;
|
||||
@@ -230,15 +230,9 @@ public final class CommandMap {
|
||||
if (SERVER.logCommands) {
|
||||
if (player != null) {
|
||||
Grasscutter.getLogger()
|
||||
.info(
|
||||
"Command used by ["
|
||||
+ player.getAccount().getUsername()
|
||||
+ " (Player UID: "
|
||||
+ player.getUid()
|
||||
+ ")]: "
|
||||
+ rawMessage);
|
||||
.info("Command used by [{} (Player UID: {})]: {}", player.getAccount().getUsername(), player.getUid(), rawMessage);
|
||||
} else {
|
||||
Grasscutter.getLogger().info("Command used by server console: " + rawMessage);
|
||||
Grasscutter.getLogger().info("Command used by server console: {}", rawMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,12 +344,10 @@ public final class CommandMap {
|
||||
this.registerCommand(cmdData.label(), (CommandHandler) object);
|
||||
else
|
||||
Grasscutter.getLogger()
|
||||
.error("Class " + annotated.getName() + " is not a CommandHandler!");
|
||||
.error("Class {} is not a CommandHandler!", annotated.getName());
|
||||
} catch (Exception exception) {
|
||||
Grasscutter.getLogger()
|
||||
.error(
|
||||
"Failed to register command handler for " + annotated.getSimpleName(),
|
||||
exception);
|
||||
.error("Failed to register command handler for {}", annotated.getSimpleName(), exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user