mirror of
https://github.com/aikar/commands.git
synced 2026-06-05 08:32:17 +00:00
Death to ACFLog (#42)
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
package co.aikar.commands;
|
||||
|
||||
import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil;
|
||||
import co.aikar.timings.Timing;
|
||||
import co.aikar.timings.Timings;
|
||||
import org.spongepowered.api.Sponge;
|
||||
@@ -119,4 +120,29 @@ public class SpongeCommandManager extends CommandManager {
|
||||
public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
|
||||
return new RegisteredCommand(command, cmdName, method, prefSubCommand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(final LogLevel level, final String message) {
|
||||
switch(level) {
|
||||
case INFO:
|
||||
this.plugin.getLogger().info(LogLevel.LOG_PREFIX + message);
|
||||
return;
|
||||
case ERROR:
|
||||
this.plugin.getLogger().error(LogLevel.LOG_PREFIX + message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(final LogLevel level, final String message, final Throwable throwable) {
|
||||
switch(level) {
|
||||
case INFO:
|
||||
this.plugin.getLogger().info(LogLevel.LOG_PREFIX + message, throwable);
|
||||
return;
|
||||
case ERROR:
|
||||
this.plugin.getLogger().error(LogLevel.LOG_PREFIX + message, throwable);
|
||||
for(String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) {
|
||||
this.plugin.getLogger().error(LogLevel.LOG_PREFIX + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ public class SpongeRootCommand implements CommandCallable, RootCommand {
|
||||
}
|
||||
BaseCommand regged = this.subCommands.get(key);
|
||||
if (regged != null) {
|
||||
ACFLog.severe("ACF Error: " + command.getName() + " registered subcommand " + key + " for root command " + this.name + " - but it is already defined in " + regged.getName());
|
||||
ACFLog.severe("2 subcommands of the same prefix may not be spread over 2 different classes. Ignoring this.");
|
||||
this.manager.log(LogLevel.ERROR, "ACF Error: " + command.getName() + " registered subcommand " + key + " for root command " + this.name + " - but it is already defined in " + regged.getName());
|
||||
this.manager.log(LogLevel.ERROR, "2 subcommands of the same prefix may not be spread over 2 different classes. Ignoring this.");
|
||||
return;
|
||||
}
|
||||
this.subCommands.put(key, command);
|
||||
|
||||
Reference in New Issue
Block a user