Fix NPE
This commit is contained in:
parent
18dd59ed0f
commit
b7ac7680d9
@ -38,7 +38,6 @@ import me.lucko.luckperms.common.utils.ImmutableCollectors;
|
||||
import me.lucko.luckperms.sponge.LPSpongePlugin;
|
||||
import me.lucko.luckperms.sponge.model.SpongeGroup;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.simple.SimpleCollection;
|
||||
import me.lucko.luckperms.sponge.timings.LPTiming;
|
||||
import org.spongepowered.api.service.context.Context;
|
||||
import org.spongepowered.api.service.permission.PermissionService;
|
||||
@ -52,7 +51,6 @@ import java.util.Set;
|
||||
|
||||
public class SpongeGroupManager implements GroupManager, SubjectCollection {
|
||||
private final LPSpongePlugin plugin;
|
||||
private final SimpleCollection fallback;
|
||||
|
||||
private final LoadingCache<String, SpongeGroup> objects = CacheBuilder.newBuilder()
|
||||
.build(new CacheLoader<String, SpongeGroup>() {
|
||||
@ -69,7 +67,6 @@ public class SpongeGroupManager implements GroupManager, SubjectCollection {
|
||||
|
||||
public SpongeGroupManager(LPSpongePlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.fallback = plugin.getService().getFallbackGroupSubjects();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,7 +127,7 @@ public class SpongeGroupManager implements GroupManager, SubjectCollection {
|
||||
id = id.toLowerCase();
|
||||
if (ArgumentChecker.checkName(id)) {
|
||||
plugin.getLog().warn("Couldn't get group subject for id: " + id + " (invalid name)");
|
||||
return fallback.get(id); // fallback to transient collection
|
||||
return plugin.getService().getFallbackGroupSubjects().get(id); // fallback to transient collection
|
||||
}
|
||||
|
||||
// check if the group is loaded in memory.
|
||||
@ -146,7 +143,7 @@ public class SpongeGroupManager implements GroupManager, SubjectCollection {
|
||||
|
||||
if (group == null) {
|
||||
plugin.getLog().severe("Error whilst loading group '" + id + "'.");
|
||||
return fallback.get(id);
|
||||
return plugin.getService().getFallbackGroupSubjects().get(id);
|
||||
}
|
||||
|
||||
plugin.getLog().warn("Loading '" + id + "' took " + (System.currentTimeMillis() - startTime) + " ms.");
|
||||
|
@ -40,7 +40,6 @@ import me.lucko.luckperms.common.utils.ImmutableCollectors;
|
||||
import me.lucko.luckperms.sponge.LPSpongePlugin;
|
||||
import me.lucko.luckperms.sponge.model.SpongeUser;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.simple.SimpleCollection;
|
||||
import me.lucko.luckperms.sponge.timings.LPTiming;
|
||||
import org.spongepowered.api.service.context.Context;
|
||||
import org.spongepowered.api.service.permission.PermissionService;
|
||||
@ -55,7 +54,6 @@ import java.util.UUID;
|
||||
|
||||
public class SpongeUserManager implements UserManager, SubjectCollection {
|
||||
private final LPSpongePlugin plugin;
|
||||
private final SimpleCollection fallback;
|
||||
|
||||
private final LoadingCache<UserIdentifier, SpongeUser> objects = CacheBuilder.newBuilder()
|
||||
.build(new CacheLoader<UserIdentifier, SpongeUser>() {
|
||||
@ -72,7 +70,6 @@ public class SpongeUserManager implements UserManager, SubjectCollection {
|
||||
|
||||
public SpongeUserManager(LPSpongePlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.fallback = plugin.getService().getFallbackUserSubjects();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -180,7 +177,7 @@ public class SpongeUserManager implements UserManager, SubjectCollection {
|
||||
UUID uuid = Util.parseUuid(id);
|
||||
if (uuid == null) {
|
||||
plugin.getLog().warn("Couldn't get user subject for id: " + id + " (not a uuid)");
|
||||
return fallback.get(id); // fallback to the transient collection
|
||||
return plugin.getService().getFallbackUserSubjects().get(id); // fallback to the transient collection
|
||||
}
|
||||
|
||||
UUID u = plugin.getUuidCache().getUUID(uuid);
|
||||
@ -198,7 +195,7 @@ public class SpongeUserManager implements UserManager, SubjectCollection {
|
||||
|
||||
if (user == null) {
|
||||
plugin.getLog().severe("Error whilst loading user '" + u + "'.");
|
||||
return fallback.get(u.toString());
|
||||
return plugin.getService().getFallbackUserSubjects().get(u.toString());
|
||||
}
|
||||
|
||||
user.setupData(false);
|
||||
|
Loading…
Reference in New Issue
Block a user