mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Slight speed improvement for import processes
This commit is contained in:
parent
073b775566
commit
c35ab38f36
@ -167,7 +167,12 @@ public abstract class SubCommand<T> extends Command<T, Void> {
|
||||
|
||||
public static void save(User user, Sender sender, LuckPermsPlugin plugin) {
|
||||
boolean success = plugin.getStorage().force().saveUser(user).join();
|
||||
|
||||
if (sender.isImport()) {
|
||||
user.getRefreshBuffer().request();
|
||||
} else {
|
||||
user.getRefreshBuffer().requestDirectly();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
Message.USER_SAVE_SUCCESS.send(sender);
|
||||
@ -178,7 +183,12 @@ public abstract class SubCommand<T> extends Command<T, Void> {
|
||||
|
||||
public static void save(Group group, Sender sender, LuckPermsPlugin plugin) {
|
||||
boolean success = plugin.getStorage().force().saveGroup(group).join();
|
||||
|
||||
if (sender.isImport()) {
|
||||
plugin.getUpdateTaskBuffer().request();
|
||||
} else {
|
||||
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
Message.GROUP_SAVE_SUCCESS.send(sender);
|
||||
@ -189,7 +199,12 @@ public abstract class SubCommand<T> extends Command<T, Void> {
|
||||
|
||||
public static void save(Track track, Sender sender, LuckPermsPlugin plugin) {
|
||||
boolean success = plugin.getStorage().force().saveTrack(track).join();
|
||||
|
||||
if (sender.isImport()) {
|
||||
plugin.getUpdateTaskBuffer().request();
|
||||
} else {
|
||||
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
Message.TRACK_SAVE_SUCCESS.send(sender);
|
||||
|
@ -93,4 +93,9 @@ public class AbstractSender<T> implements Sender {
|
||||
return this.uuid.equals(Constants.CONSOLE_UUID) || this.uuid.equals(Constants.IMPORT_UUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImport() {
|
||||
return this.uuid.equals(Constants.IMPORT_UUID);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -85,4 +85,11 @@ public interface Sender {
|
||||
*/
|
||||
boolean isConsole();
|
||||
|
||||
/**
|
||||
* Gets whether this sender is an import process
|
||||
*
|
||||
* @return if the sender is an import process
|
||||
*/
|
||||
boolean isImport();
|
||||
|
||||
}
|
||||
|
@ -101,6 +101,10 @@ public class PriorityComparator implements Comparator<LocalizedNode> {
|
||||
}
|
||||
|
||||
public int compareStrings(String o1, String o2) {
|
||||
if (o1.equals(o2)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
CollationKey o1c = collationKeyCache.get(o1);
|
||||
CollationKey o2c = collationKeyCache.get(o2);
|
||||
|
@ -213,6 +213,11 @@ public class Importer implements Runnable {
|
||||
public boolean isConsole() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImport() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
@ -68,7 +68,6 @@ public class SpongeMigrationUtils {
|
||||
}
|
||||
|
||||
// Migrate options
|
||||
try {
|
||||
Map<Set<Context>, Map<String, String>> opts = subject.getSubjectData().getAllOptions();
|
||||
for (Map.Entry<Set<Context>, Map<String, String>> e : opts.entrySet()) {
|
||||
ContextSet context = Util.convertContexts(e.getKey());
|
||||
@ -88,9 +87,6 @@ public class SpongeMigrationUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
// Ignore. This is just so older versions of Sponge API can be used.
|
||||
}
|
||||
|
||||
// Migrate parents
|
||||
Map<Set<Context>, List<Subject>> parents = subject.getSubjectData().getAllParents();
|
||||
|
Loading…
Reference in New Issue
Block a user