Fix migration log being sent to the console twice

This commit is contained in:
Luck 2017-01-31 12:29:06 +00:00
parent 0be6d658ed
commit 8dbb083b90
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
11 changed files with 39 additions and 10 deletions

View File

@ -180,7 +180,9 @@ public class MigrationBPermissions extends SubCommand<Object> {
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting bPermissions migration.");

View File

@ -64,7 +64,9 @@ public class MigrationGroupManager extends SubCommand<Object> {
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting GroupManager migration.");

View File

@ -65,7 +65,9 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting PermissionsEx migration.");

View File

@ -200,7 +200,9 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
private CommandResult run(LuckPermsPlugin plugin, Sender sender, List<String> args) {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting PowerfulPerms migration.");

View File

@ -60,7 +60,9 @@ public class MigrationZPermissions extends SubCommand<Object> {
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting zPermissions migration.");

View File

@ -57,7 +57,9 @@ public class MigrationBungeePerms extends SubCommand<Object> {
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting BungeePerms migration.");

View File

@ -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()) {

View File

@ -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);
}

View File

@ -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();
}

View File

@ -57,7 +57,9 @@ public class MigrationPermissionManager extends SubCommand<Object> {
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting PermissionManager migration.");

View File

@ -64,7 +64,9 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
Consumer<String> log = s -> {
Message.MIGRATION_LOG.send(sender, s);
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
if (!sender.isConsole()) {
Message.MIGRATION_LOG.send(plugin.getConsoleSender(), s);
}
};
log.accept("Starting PermissionsEx migration.");