Fix migration log being sent to the console twice

This commit is contained in:
Luck
2017-01-31 12:29:06 +00:00
Unverified
parent 0be6d658ed
commit 8dbb083b90
11 changed files with 39 additions and 10 deletions
@@ -110,7 +110,12 @@ public class ExportCommand extends SingleCommand {
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
Consumer<String> log = s -> Message.EXPORT_LOG.send(sender, s);
Consumer<String> log = s -> {
Message.EXPORT_LOG.send(sender, s);
if (!sender.isConsole()) {
Message.EXPORT_LOG.send(plugin.getConsoleSender(), s);
}
};
File f = new File(plugin.getDataDirectory(), args.get(0));
if (f.exists()) {
@@ -86,7 +86,8 @@ public class AbstractSender<T> implements Sender {
return false;
}
private boolean isConsole() {
@Override
public boolean isConsole() {
return this.uuid.equals(Constants.CONSOLE_UUID) || this.uuid.equals(Constants.IMPORT_UUID);
}
@@ -78,4 +78,11 @@ public interface Sender {
*/
boolean hasPermission(Permission permission);
/**
* Gets whether this sender is the console
*
* @return if the sender is the console
*/
boolean isConsole();
}