mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-21 07:41:52 +01:00
Some minor code cleanup (#1262)
This commit is contained in:
parent
f96518b8e4
commit
ee2de3cff1
@ -116,10 +116,10 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
|||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
AtomicInteger userLoadCount = new AtomicInteger(0);
|
AtomicInteger userLoadCount = new AtomicInteger(0);
|
||||||
users.forEach(s -> {
|
for (String user : users) {
|
||||||
world.loadOne(s, CalculableType.USER);
|
world.loadOne(user, CalculableType.USER);
|
||||||
log.logProgress("Forcefully loaded {} users so far.", userLoadCount.incrementAndGet());
|
log.logProgress("Forcefully loaded {} users so far.", userLoadCount.incrementAndGet());
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
log.log("Forcefully loaded all users.");
|
log.log("Forcefully loaded all users.");
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of {@link LogEntry} and {@link LogEntry.Builder},
|
* 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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ public class Importer implements Runnable {
|
|||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
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();
|
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);
|
AtomicInteger errIndex = new AtomicInteger(1);
|
||||||
for (ImportCommand e : this.commands) {
|
for (ImportCommand e : this.commands) {
|
||||||
if (e.getResult() != null && e.getResult().wasFailure()) {
|
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());
|
Message.IMPORT_END_ERROR_HEADER.send(s, errIndex.get(), e.getId(), e.getCommand(), e.getResult().toString());
|
||||||
for (String out : e.getOutput()) {
|
e.getOutput().forEach(out -> Message.IMPORT_END_ERROR_CONTENT.send(s, out));
|
||||||
Message.IMPORT_END_ERROR_CONTENT.send(s, out);
|
|
||||||
}
|
|
||||||
Message.IMPORT_END_ERROR_FOOTER.send(s);
|
Message.IMPORT_END_ERROR_FOOTER.send(s);
|
||||||
});
|
}
|
||||||
|
|
||||||
errIndex.incrementAndGet();
|
errIndex.incrementAndGet();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public final class TabCompletions {
|
|||||||
|
|
||||||
return root.getChildren().get().keySet().stream()
|
return root.getChildren().get().keySet().stream()
|
||||||
.filter(TabCompleter.startsWithIgnoreCase(incomplete))
|
.filter(TabCompleter.startsWithIgnoreCase(incomplete))
|
||||||
.map(s -> parts.stream().collect(Collectors.joining(".")) + "." + s)
|
.map(s -> String.join(".", parts) + "." + s)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ import me.lucko.luckperms.common.utils.Predicates;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class LogSearch extends SubCommand<Log> {
|
public class LogSearch extends SubCommand<Log> {
|
||||||
private static final int ENTRIES_PER_PAGE = 10;
|
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));
|
Paginated<ExtendedLogEntry> content = new Paginated<>(log.getSearch(query));
|
||||||
|
|
||||||
if (page != Integer.MIN_VALUE) {
|
if (page != Integer.MIN_VALUE) {
|
||||||
|
@ -73,7 +73,7 @@ public class VerboseCommand extends SingleCommand {
|
|||||||
filters.addAll(args.subList(1, args.size()));
|
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;
|
VerboseFilter parsedFilter;
|
||||||
try {
|
try {
|
||||||
|
@ -142,7 +142,7 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
|||||||
if (weak && this.name != null) {
|
if (weak && this.name != null) {
|
||||||
|
|
||||||
// try to update casing if they're equalIgnoreCase
|
// try to update casing if they're equalIgnoreCase
|
||||||
if (name != null && this.name.equalsIgnoreCase(name)) {
|
if (this.name.equalsIgnoreCase(name)) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class SpongeUserManager extends AbstractUserManager<SpongeUser> implement
|
|||||||
private final LPSpongePlugin plugin;
|
private final LPSpongePlugin plugin;
|
||||||
private SubjectCollection spongeProxy = null;
|
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)
|
.expireAfterWrite(1, TimeUnit.MINUTES)
|
||||||
.build(u -> {
|
.build(u -> {
|
||||||
// clock in with the housekeeper
|
// clock in with the housekeeper
|
||||||
|
Loading…
Reference in New Issue
Block a user