mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Cleanup usages of loadUser/loadGroup/loadTrack - eliminate possibility for unloading race condition (#706)
This commit is contained in:
parent
40294b10f5
commit
1f70ad978f
@ -314,8 +314,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
|||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
this.scheduler.doAsync(() -> {
|
this.scheduler.doAsync(() -> {
|
||||||
try {
|
try {
|
||||||
connectionListener.loadUser(player.getUniqueId(), player.getName());
|
User user = connectionListener.loadUser(player.getUniqueId(), player.getName());
|
||||||
User user = getUserManager().getIfLoaded(player.getUniqueId());
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
this.scheduler.doSync(() -> {
|
this.scheduler.doSync(() -> {
|
||||||
try {
|
try {
|
||||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.bukkit.migration;
|
|||||||
|
|
||||||
import de.bananaco.bpermissions.api.Calculable;
|
import de.bananaco.bpermissions.api.Calculable;
|
||||||
import de.bananaco.bpermissions.api.CalculableType;
|
import de.bananaco.bpermissions.api.CalculableType;
|
||||||
import de.bananaco.bpermissions.api.Group;
|
|
||||||
import de.bananaco.bpermissions.api.Permission;
|
import de.bananaco.bpermissions.api.Permission;
|
||||||
import de.bananaco.bpermissions.api.World;
|
import de.bananaco.bpermissions.api.World;
|
||||||
import de.bananaco.bpermissions.api.WorldManager;
|
import de.bananaco.bpermissions.api.WorldManager;
|
||||||
@ -41,6 +40,7 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
|||||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.logging.ProgressLogger;
|
import me.lucko.luckperms.common.logging.ProgressLogger;
|
||||||
|
import me.lucko.luckperms.common.model.Group;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.node.NodeFactory;
|
import me.lucko.luckperms.common.node.NodeFactory;
|
||||||
@ -61,13 +61,13 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
import static me.lucko.luckperms.common.commands.CommandPermission.MIGRATION;
|
import static me.lucko.luckperms.common.commands.CommandPermission.MIGRATION;
|
||||||
|
|
||||||
public class MigrationBPermissions extends SubCommand<Object> {
|
public class MigrationBPermissions extends SubCommand<Object> {
|
||||||
private static Field uConfigField;
|
private static final Field UCONFIG_FIELD;
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
uConfigField = Class.forName("de.bananaco.bpermissions.imp.YamlWorld").getDeclaredField("uconfig");
|
UCONFIG_FIELD = Class.forName("de.bananaco.bpermissions.imp.YamlWorld").getDeclaredField("uconfig");
|
||||||
uConfigField.setAccessible(true);
|
UCONFIG_FIELD.setAccessible(true);
|
||||||
} catch (Throwable t) {
|
} catch (ClassNotFoundException | NoSuchFieldException e) {
|
||||||
t.printStackTrace();
|
throw new ExceptionInInitializerError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
|||||||
|
|
||||||
YamlConfiguration yamlWorldUsers = null;
|
YamlConfiguration yamlWorldUsers = null;
|
||||||
try {
|
try {
|
||||||
yamlWorldUsers = (YamlConfiguration) uConfigField.get(world);
|
yamlWorldUsers = (YamlConfiguration) UCONFIG_FIELD.get(world);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -138,8 +138,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a LuckPerms group for the one being migrated.
|
// Make a LuckPerms group for the one being migrated.
|
||||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
Group lpGroup = plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||||
me.lucko.luckperms.common.model.Group lpGroup = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
|
|
||||||
MigrationUtils.setGroupWeight(lpGroup, group.getPriority());
|
MigrationUtils.setGroupWeight(lpGroup, group.getPriority());
|
||||||
migrateHolder(world, group, lpGroup);
|
migrateHolder(world, group, lpGroup);
|
||||||
@ -162,8 +161,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a LuckPerms user for the one being migrated.
|
// Make a LuckPerms user for the one being migrated.
|
||||||
plugin.getStorage().loadUser(uuid, null).join();
|
User lpUser = plugin.getStorage().loadUser(uuid, null).join();
|
||||||
User lpUser = plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
|
|
||||||
migrateHolder(world, user, lpUser);
|
migrateHolder(world, user, lpUser);
|
||||||
|
|
||||||
@ -199,14 +197,14 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Migrate any inherited groups
|
// Migrate any inherited groups
|
||||||
for (Group parent : c.getGroups()) {
|
c.getGroups().forEach(parent -> {
|
||||||
String parentName = MigrationUtils.standardizeName(parent.getName());
|
String parentName = MigrationUtils.standardizeName(parent.getName());
|
||||||
if (parent.getName().equalsIgnoreCase(world.getDefaultGroup())) {
|
if (parent.getName().equalsIgnoreCase(world.getDefaultGroup())) {
|
||||||
parentName = NodeFactory.DEFAULT_GROUP_NAME;
|
parentName = NodeFactory.DEFAULT_GROUP_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.setPermission(NodeFactory.make(NodeFactory.groupNode(parentName), true, "global", world.getName()));
|
holder.setPermission(NodeFactory.make(NodeFactory.groupNode(parentName), true, "global", world.getName()));
|
||||||
}
|
});
|
||||||
|
|
||||||
// Migrate existing meta
|
// Migrate existing meta
|
||||||
for (Map.Entry<String, String> meta : c.getMeta().entrySet()) {
|
for (Map.Entry<String, String> meta : c.getMeta().entrySet()) {
|
||||||
|
@ -36,6 +36,8 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
|||||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.logging.ProgressLogger;
|
import me.lucko.luckperms.common.logging.ProgressLogger;
|
||||||
|
import me.lucko.luckperms.common.model.Group;
|
||||||
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.node.NodeFactory;
|
import me.lucko.luckperms.common.node.NodeFactory;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
@ -93,9 +95,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
|||||||
AtomicInteger globalGroupCount = new AtomicInteger(0);
|
AtomicInteger globalGroupCount = new AtomicInteger(0);
|
||||||
SafeIterator.iterate(gg.getGroupList(), g -> {
|
SafeIterator.iterate(gg.getGroupList(), g -> {
|
||||||
String groupName = MigrationUtils.standardizeName(g.getName());
|
String groupName = MigrationUtils.standardizeName(g.getName());
|
||||||
|
Group group = plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
|
||||||
me.lucko.luckperms.common.model.Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
|
|
||||||
for (String node : g.getPermissionList()) {
|
for (String node : g.getPermissionList()) {
|
||||||
if (node.isEmpty()) continue;
|
if (node.isEmpty()) continue;
|
||||||
@ -211,8 +211,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
|||||||
log.log("Starting group migration.");
|
log.log("Starting group migration.");
|
||||||
AtomicInteger groupCount = new AtomicInteger(0);
|
AtomicInteger groupCount = new AtomicInteger(0);
|
||||||
SafeIterator.iterate(groups.entrySet(), e -> {
|
SafeIterator.iterate(groups.entrySet(), e -> {
|
||||||
plugin.getStorage().createAndLoadGroup(e.getKey(), CreationCause.INTERNAL).join();
|
Group group = plugin.getStorage().createAndLoadGroup(e.getKey(), CreationCause.INTERNAL).join();
|
||||||
me.lucko.luckperms.common.model.Group group = plugin.getGroupManager().getIfLoaded(e.getKey());
|
|
||||||
|
|
||||||
for (Node node : e.getValue()) {
|
for (Node node : e.getValue()) {
|
||||||
group.setPermission(node);
|
group.setPermission(node);
|
||||||
@ -226,8 +225,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
|||||||
log.log("Starting user migration.");
|
log.log("Starting user migration.");
|
||||||
AtomicInteger userCount = new AtomicInteger(0);
|
AtomicInteger userCount = new AtomicInteger(0);
|
||||||
SafeIterator.iterate(users.entrySet(), e -> {
|
SafeIterator.iterate(users.entrySet(), e -> {
|
||||||
plugin.getStorage().loadUser(e.getKey(), null).join();
|
User user = plugin.getStorage().loadUser(e.getKey(), null).join();
|
||||||
me.lucko.luckperms.common.model.User user = plugin.getUserManager().getIfLoaded(e.getKey());
|
|
||||||
|
|
||||||
for (Node node : e.getValue()) {
|
for (Node node : e.getValue()) {
|
||||||
user.setPermission(node);
|
user.setPermission(node);
|
||||||
|
@ -81,8 +81,7 @@ public class MigrationPermissionsBukkit extends SubCommand<Object> {
|
|||||||
|
|
||||||
SafeIterator.iterate(groupsSection.getKeys(false), key -> {
|
SafeIterator.iterate(groupsSection.getKeys(false), key -> {
|
||||||
final String groupName = MigrationUtils.standardizeName(key);
|
final String groupName = MigrationUtils.standardizeName(key);
|
||||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
Group lpGroup = plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||||
Group lpGroup = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
|
|
||||||
// migrate data
|
// migrate data
|
||||||
if (groupsSection.isConfigurationSection(key)) {
|
if (groupsSection.isConfigurationSection(key)) {
|
||||||
@ -106,8 +105,7 @@ public class MigrationPermissionsBukkit extends SubCommand<Object> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getStorage().loadUser(uuid, null).join();
|
User lpUser = plugin.getStorage().loadUser(uuid, null).join();
|
||||||
User lpUser = plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
|
|
||||||
// migrate data
|
// migrate data
|
||||||
if (usersSection.isConfigurationSection(key)) {
|
if (usersSection.isConfigurationSection(key)) {
|
||||||
|
@ -96,8 +96,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
int groupWeight = maxWeight - group.getRank();
|
int groupWeight = maxWeight - group.getRank();
|
||||||
|
|
||||||
final String groupName = MigrationUtils.standardizeName(group.getName());
|
final String groupName = MigrationUtils.standardizeName(group.getName());
|
||||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
Group lpGroup = plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||||
Group lpGroup = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
|
|
||||||
MigrationUtils.setGroupWeight(lpGroup, groupWeight);
|
MigrationUtils.setGroupWeight(lpGroup, groupWeight);
|
||||||
|
|
||||||
@ -117,8 +116,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
// Migrate all ladders/tracks.
|
// Migrate all ladders/tracks.
|
||||||
log.log("Starting tracks migration.");
|
log.log("Starting tracks migration.");
|
||||||
for (String rankLadder : ladders) {
|
for (String rankLadder : ladders) {
|
||||||
plugin.getStorage().createAndLoadTrack(rankLadder, CreationCause.INTERNAL).join();
|
Track track = plugin.getStorage().createAndLoadTrack(rankLadder, CreationCause.INTERNAL).join();
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(rankLadder);
|
|
||||||
|
|
||||||
// Get a list of all groups in a ladder
|
// Get a list of all groups in a ladder
|
||||||
List<String> ladder = manager.getRankLadder(rankLadder).entrySet().stream()
|
List<String> ladder = manager.getRankLadder(rankLadder).entrySet().stream()
|
||||||
@ -145,8 +143,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load in a user instance
|
// load in a user instance
|
||||||
plugin.getStorage().loadUser(u, user.getName()).join();
|
User lpUser = plugin.getStorage().loadUser(u, user.getName()).join();
|
||||||
User lpUser = plugin.getUserManager().getIfLoaded(u);
|
|
||||||
|
|
||||||
// migrate data
|
// migrate data
|
||||||
migrateEntity(user, lpUser, userWeight);
|
migrateEntity(user, lpUser, userWeight);
|
||||||
|
@ -162,8 +162,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
|||||||
maxWeight.set(Math.max(maxWeight.get(), g.getRank()));
|
maxWeight.set(Math.max(maxWeight.get(), g.getRank()));
|
||||||
|
|
||||||
String groupName = MigrationUtils.standardizeName(g.getName());
|
String groupName = MigrationUtils.standardizeName(g.getName());
|
||||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
me.lucko.luckperms.common.model.Group group = plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||||
me.lucko.luckperms.common.model.Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
|
|
||||||
MigrationUtils.setGroupWeight(group, g.getRank());
|
MigrationUtils.setGroupWeight(group, g.getRank());
|
||||||
|
|
||||||
@ -222,8 +221,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
|||||||
SafeIterator.iterate(uuids, uuid -> {
|
SafeIterator.iterate(uuids, uuid -> {
|
||||||
|
|
||||||
// Create a LuckPerms user for the UUID
|
// Create a LuckPerms user for the UUID
|
||||||
plugin.getStorage().loadUser(uuid, null).join();
|
User user = plugin.getStorage().loadUser(uuid, null).join();
|
||||||
User user = plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
|
|
||||||
List<Permission> permissions = joinFuture(pm.getPlayerOwnPermissions(uuid));
|
List<Permission> permissions = joinFuture(pm.getPlayerOwnPermissions(uuid));
|
||||||
|
|
||||||
|
@ -106,8 +106,7 @@ public class MigrationZPermissions extends SubCommand<Object> {
|
|||||||
AtomicInteger maxWeight = new AtomicInteger(0);
|
AtomicInteger maxWeight = new AtomicInteger(0);
|
||||||
SafeIterator.iterate(internalService.getEntities(true), entity -> {
|
SafeIterator.iterate(internalService.getEntities(true), entity -> {
|
||||||
String groupName = MigrationUtils.standardizeName(entity.getDisplayName());
|
String groupName = MigrationUtils.standardizeName(entity.getDisplayName());
|
||||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
Group group = plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
|
|
||||||
int weight = entity.getPriority();
|
int weight = entity.getPriority();
|
||||||
maxWeight.set(Math.max(maxWeight.get(), weight));
|
maxWeight.set(Math.max(maxWeight.get(), weight));
|
||||||
@ -141,9 +140,7 @@ public class MigrationZPermissions extends SubCommand<Object> {
|
|||||||
AtomicInteger trackCount = new AtomicInteger(0);
|
AtomicInteger trackCount = new AtomicInteger(0);
|
||||||
SafeIterator.iterate(service.getAllTracks(), t -> {
|
SafeIterator.iterate(service.getAllTracks(), t -> {
|
||||||
String trackName = MigrationUtils.standardizeName(t);
|
String trackName = MigrationUtils.standardizeName(t);
|
||||||
|
Track track = plugin.getStorage().createAndLoadTrack(trackName, CreationCause.INTERNAL).join();
|
||||||
plugin.getStorage().createAndLoadTrack(trackName, CreationCause.INTERNAL).join();
|
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(trackName);
|
|
||||||
track.setGroups(service.getTrackGroups(t));
|
track.setGroups(service.getTrackGroups(t));
|
||||||
plugin.getStorage().saveTrack(track);
|
plugin.getStorage().saveTrack(track);
|
||||||
|
|
||||||
@ -167,8 +164,7 @@ public class MigrationZPermissions extends SubCommand<Object> {
|
|||||||
username = entity.getDisplayName();
|
username = entity.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getStorage().loadUser(u, username).join();
|
User user = plugin.getStorage().loadUser(u, username).join();
|
||||||
User user = plugin.getUserManager().getIfLoaded(u);
|
|
||||||
|
|
||||||
// migrate permissions & meta
|
// migrate permissions & meta
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
|
@ -87,8 +87,7 @@ public class MigrationBungeePerms extends SubCommand<Object> {
|
|||||||
|
|
||||||
// Make a LuckPerms group for the one being migrated
|
// Make a LuckPerms group for the one being migrated
|
||||||
String groupName = MigrationUtils.standardizeName(g.getName());
|
String groupName = MigrationUtils.standardizeName(g.getName());
|
||||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
me.lucko.luckperms.common.model.Group group = plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||||
me.lucko.luckperms.common.model.Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
|
|
||||||
MigrationUtils.setGroupWeight(group, groupWeight);
|
MigrationUtils.setGroupWeight(group, groupWeight);
|
||||||
migrateHolder(g, g.getInheritances(), groupWeight, group);
|
migrateHolder(g, g.getInheritances(), groupWeight, group);
|
||||||
@ -112,8 +111,7 @@ public class MigrationBungeePerms extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a LuckPerms user for the one being migrated.
|
// Make a LuckPerms user for the one being migrated.
|
||||||
plugin.getStorage().loadUser(u.getUUID(), u.getName()).join();
|
me.lucko.luckperms.common.model.User user = plugin.getStorage().loadUser(u.getUUID(), u.getName()).join();
|
||||||
me.lucko.luckperms.common.model.User user = plugin.getUserManager().getIfLoaded(u.getUUID());
|
|
||||||
|
|
||||||
migrateHolder(u, u.getGroupsString(), userWeight, user);
|
migrateHolder(u, u.getGroupsString(), userWeight, user);
|
||||||
|
|
||||||
|
@ -220,8 +220,7 @@ public class Exporter implements Runnable {
|
|||||||
// actually export the user. this output will be fed to the writing function when we have all of the user's data.
|
// actually export the user. this output will be fed to the writing function when we have all of the user's data.
|
||||||
List<String> output = new ArrayList<>();
|
List<String> output = new ArrayList<>();
|
||||||
|
|
||||||
this.plugin.getStorage().loadUser(uuid, null).join();
|
User user = this.plugin.getStorage().loadUser(uuid, null).join();
|
||||||
User user = this.plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
output.add("# Export user: " + user.getUuid().toString() + " - " + user.getName().orElse("unknown username"));
|
output.add("# Export user: " + user.getUuid().toString() + " - " + user.getName().orElse("unknown username"));
|
||||||
|
|
||||||
boolean inDefault = false;
|
boolean inDefault = false;
|
||||||
|
@ -64,15 +64,10 @@ public class ParentAdd extends SharedSubCommand {
|
|||||||
String groupName = ArgumentUtils.handleName(0, args);
|
String groupName = ArgumentUtils.handleName(0, args);
|
||||||
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
|
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
Message.DOES_NOT_EXIST.send(sender, groupName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
|
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
|
||||||
|
@ -71,12 +71,7 @@ public class ParentAddTemp extends SharedSubCommand {
|
|||||||
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
|
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
|
||||||
TemporaryModifier modifier = plugin.getConfiguration().get(ConfigKeys.TEMPORARY_ADD_BEHAVIOUR);
|
TemporaryModifier modifier = plugin.getConfiguration().get(ConfigKeys.TEMPORARY_ADD_BEHAVIOUR);
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
Message.DOES_NOT_EXIST.send(sender, groupName);
|
||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
|
@ -67,12 +67,7 @@ public class ParentClearTrack extends SharedSubCommand {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadTrack(trackName).join().isPresent()) {
|
Track track = plugin.getStorage().loadTrack(trackName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(trackName);
|
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
Message.DOES_NOT_EXIST.send(sender, trackName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -64,12 +64,7 @@ public class ParentSet extends SharedSubCommand {
|
|||||||
String groupName = ArgumentUtils.handleName(0, args);
|
String groupName = ArgumentUtils.handleName(0, args);
|
||||||
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
|
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
Message.DOES_NOT_EXIST.send(sender, groupName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -69,12 +69,7 @@ public class ParentSetTrack extends SharedSubCommand {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadTrack(trackName).join().isPresent()) {
|
Track track = plugin.getStorage().loadTrack(trackName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(trackName);
|
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
Message.DOES_NOT_EXIST.send(sender, trackName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
@ -104,12 +99,7 @@ public class ParentSetTrack extends SharedSubCommand {
|
|||||||
|
|
||||||
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
|
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
Message.DOES_NOT_EXIST.send(sender, groupName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -62,12 +62,7 @@ public class DeleteGroup extends SingleCommand {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Message.GROUP_LOAD_ERROR.send(sender);
|
Message.GROUP_LOAD_ERROR.send(sender);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -60,9 +60,7 @@ public class GroupClone extends SubCommand<Group> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).join();
|
Group newGroup = plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).join();
|
||||||
|
|
||||||
Group newGroup = plugin.getGroupManager().getIfLoaded(newGroupName);
|
|
||||||
if (newGroup == null) {
|
if (newGroup == null) {
|
||||||
Message.GROUP_LOAD_ERROR.send(sender);
|
Message.GROUP_LOAD_ERROR.send(sender);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -84,22 +84,18 @@ public class GroupMainCommand extends MainCommand<Group, String> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Group getTarget(String target, LuckPermsPlugin plugin, Sender sender) {
|
protected Group getTarget(String target, LuckPermsPlugin plugin, Sender sender) {
|
||||||
if (!plugin.getStorage().loadGroup(target).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(target).join().orElse(null);
|
||||||
|
if (group == null) {
|
||||||
// failed to load, but it might be a display name.
|
// failed to load, but it might be a display name.
|
||||||
|
group = plugin.getGroupManager().getByDisplayName(target);
|
||||||
|
|
||||||
// nope, not a display name
|
// nope, not a display name
|
||||||
if (plugin.getGroupManager().getByDisplayName(target) == null) {
|
if (group == null) {
|
||||||
Message.GROUP_NOT_FOUND.send(sender, target);
|
Message.GROUP_NOT_FOUND.send(sender, target);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getByDisplayName(target);
|
|
||||||
if (group == null) {
|
|
||||||
Message.GROUP_NOT_FOUND.send(sender, target);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
group.auditTemporaryPermissions();
|
group.auditTemporaryPermissions();
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
@ -60,20 +60,15 @@ public class GroupRename extends SubCommand<Group> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group newGroup;
|
||||||
try {
|
try {
|
||||||
plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).get();
|
newGroup = plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Message.CREATE_ERROR.send(sender, newGroupName);
|
Message.CREATE_ERROR.send(sender, newGroupName);
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group newGroup = plugin.getGroupManager().getIfLoaded(newGroupName);
|
|
||||||
if (newGroup == null) {
|
|
||||||
Message.GROUP_LOAD_ERROR.send(sender);
|
|
||||||
return CommandResult.LOADING_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
plugin.getStorage().deleteGroup(group, DeletionCause.COMMAND).get();
|
plugin.getStorage().deleteGroup(group, DeletionCause.COMMAND).get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -55,12 +55,7 @@ public class DeleteTrack extends SingleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String trackName = args.get(0).toLowerCase();
|
String trackName = args.get(0).toLowerCase();
|
||||||
if (!plugin.getStorage().loadTrack(trackName).join().isPresent()) {
|
Track track = plugin.getStorage().loadTrack(trackName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(trackName);
|
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Message.TRACK_LOAD_ERROR.send(sender);
|
Message.TRACK_LOAD_ERROR.send(sender);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -56,12 +56,7 @@ public class TrackAppend extends SubCommand<Track> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
Message.DOES_NOT_EXIST.send(sender, groupName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -54,9 +54,7 @@ public class TrackClone extends SubCommand<Track> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.INTERNAL).join();
|
Track newTrack = plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.INTERNAL).join();
|
||||||
|
|
||||||
Track newTrack = plugin.getTrackManager().getIfLoaded(newTrackName);
|
|
||||||
if (newTrack == null) {
|
if (newTrack == null) {
|
||||||
Message.TRACK_LOAD_ERROR.send(sender);
|
Message.TRACK_LOAD_ERROR.send(sender);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -64,12 +64,7 @@ public class TrackInsert extends SubCommand<Track> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, groupName);
|
Message.DOES_NOT_EXIST.send(sender, groupName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -73,12 +73,7 @@ public class TrackMainCommand extends MainCommand<Track, String> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Track getTarget(String target, LuckPermsPlugin plugin, Sender sender) {
|
protected Track getTarget(String target, LuckPermsPlugin plugin, Sender sender) {
|
||||||
if (!plugin.getStorage().loadTrack(target).join().isPresent()) {
|
Track track = plugin.getStorage().loadTrack(target).join().orElse(null);
|
||||||
Message.TRACK_NOT_FOUND.send(sender, target);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(target);
|
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Message.TRACK_NOT_FOUND.send(sender, target);
|
Message.TRACK_NOT_FOUND.send(sender, target);
|
||||||
return null;
|
return null;
|
||||||
|
@ -60,20 +60,15 @@ public class TrackRename extends SubCommand<Track> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Track newTrack;
|
||||||
try {
|
try {
|
||||||
plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.COMMAND).get();
|
newTrack = plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.COMMAND).get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Message.CREATE_ERROR.send(sender, newTrackName);
|
Message.CREATE_ERROR.send(sender, newTrackName);
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Track newTrack = plugin.getTrackManager().getIfLoaded(newTrackName);
|
|
||||||
if (newTrack == null) {
|
|
||||||
Message.TRACK_LOAD_ERROR.send(sender);
|
|
||||||
return CommandResult.LOADING_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
plugin.getStorage().deleteTrack(track, DeletionCause.COMMAND).get();
|
plugin.getStorage().deleteTrack(track, DeletionCause.COMMAND).get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -87,9 +87,7 @@ public class UserClone extends SubCommand<User> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getStorage().loadUser(uuid, null).join();
|
User otherUser = plugin.getStorage().loadUser(uuid, null).join();
|
||||||
User otherUser = plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
|
|
||||||
if (otherUser == null) {
|
if (otherUser == null) {
|
||||||
Message.USER_LOAD_ERROR.send(sender);
|
Message.USER_LOAD_ERROR.send(sender);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -71,12 +71,7 @@ public class UserDemote extends SubCommand<User> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadTrack(trackName).join().isPresent()) {
|
Track track = plugin.getStorage().loadTrack(trackName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(trackName);
|
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
Message.DOES_NOT_EXIST.send(sender, trackName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
@ -142,12 +137,7 @@ public class UserDemote extends SubCommand<User> {
|
|||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadGroup(previous).join().isPresent()) {
|
Group previousGroup = plugin.getStorage().loadGroup(previous).join().orElse(null);
|
||||||
Message.USER_DEMOTE_ERROR_MALFORMED.send(sender, previous);
|
|
||||||
return CommandResult.STATE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group previousGroup = plugin.getGroupManager().getIfLoaded(previous);
|
|
||||||
if (previousGroup == null) {
|
if (previousGroup == null) {
|
||||||
Message.USER_DEMOTE_ERROR_MALFORMED.send(sender, previous);
|
Message.USER_DEMOTE_ERROR_MALFORMED.send(sender, previous);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -36,7 +36,6 @@ import me.lucko.luckperms.common.commands.impl.generic.other.HolderClear;
|
|||||||
import me.lucko.luckperms.common.commands.impl.generic.other.HolderEditor;
|
import me.lucko.luckperms.common.commands.impl.generic.other.HolderEditor;
|
||||||
import me.lucko.luckperms.common.commands.impl.generic.other.HolderShowTracks;
|
import me.lucko.luckperms.common.commands.impl.generic.other.HolderShowTracks;
|
||||||
import me.lucko.luckperms.common.commands.impl.generic.parent.CommandParent;
|
import me.lucko.luckperms.common.commands.impl.generic.parent.CommandParent;
|
||||||
import me.lucko.luckperms.common.commands.impl.generic.parent.UserSwitchPrimaryGroup;
|
|
||||||
import me.lucko.luckperms.common.commands.impl.generic.permission.CommandPermission;
|
import me.lucko.luckperms.common.commands.impl.generic.permission.CommandPermission;
|
||||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
@ -118,21 +117,7 @@ public class UserMainCommand extends MainCommand<User, UserIdentifier> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected User getTarget(UserIdentifier target, LuckPermsPlugin plugin, Sender sender) {
|
protected User getTarget(UserIdentifier target, LuckPermsPlugin plugin, Sender sender) {
|
||||||
|
User user = plugin.getStorage().loadUser(target.getUuid(), target.getUsername().orElse(null)).join();
|
||||||
try {
|
|
||||||
plugin.getStorage().loadUser(target.getUuid(), target.getUsername().orElse(null)).get();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Message.LOADING_ERROR.send(sender);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
User user = plugin.getUserManager().getIfLoaded(target.getUuid());
|
|
||||||
if (user == null) {
|
|
||||||
Message.LOADING_ERROR.send(sender);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
user.auditTemporaryPermissions();
|
user.auditTemporaryPermissions();
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
@ -69,12 +69,7 @@ public class UserPromote extends SubCommand<User> {
|
|||||||
return CommandResult.INVALID_ARGS;
|
return CommandResult.INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.getStorage().loadTrack(trackName).join().isPresent()) {
|
Track track = plugin.getStorage().loadTrack(trackName).join().orElse(null);
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
|
||||||
return CommandResult.INVALID_ARGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(trackName);
|
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
Message.DOES_NOT_EXIST.send(sender, trackName);
|
Message.DOES_NOT_EXIST.send(sender, trackName);
|
||||||
return CommandResult.LOADING_ERROR;
|
return CommandResult.LOADING_ERROR;
|
||||||
|
@ -91,8 +91,7 @@ public final class WebEditorUtils {
|
|||||||
Message.APPLY_EDITS_TARGET_USER_NOT_UUID.send(sender, user);
|
Message.APPLY_EDITS_TARGET_USER_NOT_UUID.send(sender, user);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
plugin.getStorage().loadUser(uuid, null).join();
|
User holder = plugin.getStorage().loadUser(uuid, null).join();
|
||||||
User holder = plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
Message.APPLY_EDITS_TARGET_USER_UNABLE_TO_LOAD.send(sender, uuid.toString());
|
Message.APPLY_EDITS_TARGET_USER_UNABLE_TO_LOAD.send(sender, uuid.toString());
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,7 @@ public class MigrationPermissionManager extends SubCommand<Object> {
|
|||||||
String pmName = MigrationUtils.standardizeName(pmGroup.getIdentifier());
|
String pmName = MigrationUtils.standardizeName(pmGroup.getIdentifier());
|
||||||
|
|
||||||
// Make a LuckPerms group for the one being migrated
|
// Make a LuckPerms group for the one being migrated
|
||||||
plugin.getStorage().createAndLoadGroup(pmName, CreationCause.INTERNAL).join();
|
Group group = plugin.getStorage().createAndLoadGroup(pmName, CreationCause.INTERNAL).join();
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(pmName);
|
|
||||||
migrateSubject(pmGroup, group, 100);
|
migrateSubject(pmGroup, group, 100);
|
||||||
plugin.getStorage().saveGroup(group);
|
plugin.getStorage().saveGroup(group);
|
||||||
|
|
||||||
@ -126,8 +125,7 @@ public class MigrationPermissionManager extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a LuckPerms user for the one being migrated
|
// Make a LuckPerms user for the one being migrated
|
||||||
plugin.getStorage().loadUser(uuid, "null").join();
|
User user = plugin.getStorage().loadUser(uuid, "null").join();
|
||||||
User user = plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
if (user.getEnduringNodes().size() <= 1) {
|
if (user.getEnduringNodes().size() <= 1) {
|
||||||
user.clearNodes(false);
|
user.clearNodes(false);
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a LuckPerms group for the one being migrated
|
// Make a LuckPerms group for the one being migrated
|
||||||
plugin.getStorage().createAndLoadGroup(pexName, CreationCause.INTERNAL).join();
|
Group group = plugin.getStorage().createAndLoadGroup(pexName, CreationCause.INTERNAL).join();
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(pexName);
|
|
||||||
migrateSubject(pexGroup, group, weight);
|
migrateSubject(pexGroup, group, weight);
|
||||||
plugin.getStorage().saveGroup(group);
|
plugin.getStorage().saveGroup(group);
|
||||||
|
|
||||||
@ -153,8 +152,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
// Migrate tracks
|
// Migrate tracks
|
||||||
log.log("Starting track migration.");
|
log.log("Starting track migration.");
|
||||||
SafeIterator.iterate(tracks.entrySet(), e -> {
|
SafeIterator.iterate(tracks.entrySet(), e -> {
|
||||||
plugin.getStorage().createAndLoadTrack(e.getKey(), CreationCause.INTERNAL).join();
|
Track track = plugin.getStorage().createAndLoadTrack(e.getKey(), CreationCause.INTERNAL).join();
|
||||||
Track track = plugin.getTrackManager().getIfLoaded(e.getKey());
|
|
||||||
for (String groupName : e.getValue().values()) {
|
for (String groupName : e.getValue().values()) {
|
||||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
@ -179,8 +177,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a LuckPerms user for the one being migrated
|
// Make a LuckPerms user for the one being migrated
|
||||||
plugin.getStorage().loadUser(uuid, null).join();
|
User user = plugin.getStorage().loadUser(uuid, null).join();
|
||||||
User user = plugin.getUserManager().getIfLoaded(uuid);
|
|
||||||
if (user.getEnduringNodes().size() <= 1) {
|
if (user.getEnduringNodes().size() <= 1) {
|
||||||
user.clearNodes(false);
|
user.clearNodes(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user