Some minor code cleanup (#1262)

This commit is contained in:
MrMicky 2018-10-09 19:00:53 +02:00 committed by Luck
parent f96518b8e4
commit ee2de3cff1
8 changed files with 13 additions and 17 deletions

View File

@ -116,10 +116,10 @@ public class MigrationBPermissions extends SubCommand<Object> {
return CommandResult.FAILURE;
}
AtomicInteger userLoadCount = new AtomicInteger(0);
users.forEach(s -> {
world.loadOne(s, CalculableType.USER);
for (String user : users) {
world.loadOne(user, CalculableType.USER);
log.logProgress("Forcefully loaded {} users so far.", userLoadCount.incrementAndGet());
});
}
}
log.log("Forcefully loaded all users.");

View File

@ -46,7 +46,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* An implementation of {@link LogEntry} and {@link LogEntry.Builder},
@ -331,7 +330,7 @@ public class ExtendedLogEntry implements LogEntry {
}
}
action(parts.stream().collect(Collectors.joining(" ")));
action(String.join(" ", parts));
return this;
}

View File

@ -165,7 +165,7 @@ public class Importer implements Runnable {
executor.shutdown();
long endTime = System.currentTimeMillis();
double seconds = (endTime - startTime) / 1000;
double seconds = (endTime - startTime) / 1000.0;
int errors = (int) this.commands.stream().filter(v -> v.getResult().wasFailure()).count();
@ -184,13 +184,11 @@ public class Importer implements Runnable {
AtomicInteger errIndex = new AtomicInteger(1);
for (ImportCommand e : this.commands) {
if (e.getResult() != null && e.getResult().wasFailure()) {
this.notify.forEach(s -> {
for (Sender s : notify) {
Message.IMPORT_END_ERROR_HEADER.send(s, errIndex.get(), e.getId(), e.getCommand(), e.getResult().toString());
for (String out : e.getOutput()) {
Message.IMPORT_END_ERROR_CONTENT.send(s, out);
}
e.getOutput().forEach(out -> Message.IMPORT_END_ERROR_CONTENT.send(s, out));
Message.IMPORT_END_ERROR_FOOTER.send(s);
});
}
errIndex.incrementAndGet();
}

View File

@ -94,7 +94,7 @@ public final class TabCompletions {
return root.getChildren().get().keySet().stream()
.filter(TabCompleter.startsWithIgnoreCase(incomplete))
.map(s -> parts.stream().collect(Collectors.joining(".")) + "." + s)
.map(s -> String.join(".", parts) + "." + s)
.collect(Collectors.toList());
};
}

View File

@ -42,7 +42,6 @@ import me.lucko.luckperms.common.utils.Predicates;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.stream.Collectors;
public class LogSearch extends SubCommand<Log> {
private static final int ENTRIES_PER_PAGE = 10;
@ -63,7 +62,7 @@ public class LogSearch extends SubCommand<Log> {
}
}
final String query = args.stream().collect(Collectors.joining(" "));
final String query = String.join(" ", args);
Paginated<ExtendedLogEntry> content = new Paginated<>(log.getSearch(query));
if (page != Integer.MIN_VALUE) {

View File

@ -73,7 +73,7 @@ public class VerboseCommand extends SingleCommand {
filters.addAll(args.subList(1, args.size()));
}
String filter = filters.isEmpty() ? "" : filters.stream().collect(Collectors.joining(" "));
String filter = filters.isEmpty() ? "" : String.join(" ", filters);
VerboseFilter parsedFilter;
try {

View File

@ -142,7 +142,7 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
if (weak && this.name != null) {
// try to update casing if they're equalIgnoreCase
if (name != null && this.name.equalsIgnoreCase(name)) {
if (this.name.equalsIgnoreCase(name)) {
this.name = name;
}

View File

@ -67,7 +67,7 @@ public class SpongeUserManager extends AbstractUserManager<SpongeUser> implement
private final LPSpongePlugin plugin;
private SubjectCollection spongeProxy = null;
private final LoadingCache<UUID, LPSubject> subjectLoadingCache = Caffeine.<UUID, LPSubject>newBuilder()
private final LoadingCache<UUID, LPSubject> subjectLoadingCache = Caffeine.newBuilder()
.expireAfterWrite(1, TimeUnit.MINUTES)
.build(u -> {
// clock in with the housekeeper