mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-23 19:16:37 +01:00
Fix various runtime errors
This commit is contained in:
parent
419707aa5f
commit
61e5da928a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* This file is part of luckperms, licensed under the MIT License.
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
|
@ -37,9 +37,28 @@ final class DefaultQueryOptions {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
private static boolean setup = false;
|
||||
private static final EnumSet<Flag> DEFAULT_FLAGS = EnumSet.allOf(Flag.class);
|
||||
private static QueryOptions contextual;
|
||||
private static QueryOptions nonContextual;
|
||||
|
||||
static final QueryOptions CONTEXTUAL = QueryOptions.contextual(ImmutableContextSet.empty(), DEFAULT_FLAGS);
|
||||
static final QueryOptions NON_CONTEXTUAL = QueryOptions.nonContextual(DEFAULT_FLAGS);
|
||||
private static void setup() {
|
||||
if (setup) {
|
||||
return;
|
||||
}
|
||||
setup = true;
|
||||
contextual = QueryOptions.contextual(ImmutableContextSet.empty(), DEFAULT_FLAGS);
|
||||
nonContextual = QueryOptions.nonContextual(DEFAULT_FLAGS);
|
||||
}
|
||||
|
||||
static QueryOptions contextual() {
|
||||
setup();
|
||||
return contextual;
|
||||
}
|
||||
|
||||
static QueryOptions nonContextual() {
|
||||
setup();
|
||||
return nonContextual;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public interface QueryOptions {
|
||||
* @return the default non contextual query options
|
||||
*/
|
||||
static @NonNull QueryOptions nonContextual() {
|
||||
return DefaultQueryOptions.NON_CONTEXTUAL;
|
||||
return DefaultQueryOptions.nonContextual();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,7 +107,7 @@ public interface QueryOptions {
|
||||
* @return the default contextual query options
|
||||
*/
|
||||
static @NonNull QueryOptions defaultContextualOptions() {
|
||||
return DefaultQueryOptions.CONTEXTUAL;
|
||||
return DefaultQueryOptions.contextual();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,6 +46,7 @@ shadowJar {
|
||||
archiveName = "LuckPerms-Bukkit-${project.ext.fullVersion}.jar"
|
||||
|
||||
dependencies {
|
||||
include(dependency('net.luckperms:.*'))
|
||||
include(dependency('me.lucko.luckperms:.*'))
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ import me.lucko.luckperms.common.cacheddata.type.MetaAccumulator;
|
||||
import me.lucko.luckperms.common.cacheddata.type.MetaCache;
|
||||
import me.lucko.luckperms.common.command.CommandManager;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.node.factory.NodeFactory;
|
||||
@ -313,7 +314,7 @@ public class LuckPermsVaultChat extends AbstractVaultChat {
|
||||
}
|
||||
|
||||
private QueryOptions createQueryOptionsForWorldSet(String world) {
|
||||
ImmutableContextSet.Builder context = ImmutableContextSet.builder();
|
||||
ImmutableContextSet.Builder context = new ImmutableContextSetImpl.BuilderImpl();
|
||||
if (world != null && !world.equals("") && !world.equalsIgnoreCase("global")) {
|
||||
context.add(DefaultContextKeys.WORLD_KEY, world.toLowerCase());
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ shadowJar {
|
||||
archiveName = "LuckPerms-Bungee-${project.ext.fullVersion}.jar"
|
||||
|
||||
dependencies {
|
||||
include(dependency('net.luckperms:.*'))
|
||||
include(dependency('me.lucko.luckperms:.*'))
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.api;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.api.implementation.ApiContextSetFactory;
|
||||
import me.lucko.luckperms.common.api.implementation.ApiNodeBuilderRegistry;
|
||||
import me.lucko.luckperms.common.query.QueryOptionsBuilderImpl;
|
||||
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.actionlog.ActionLog;
|
||||
import net.luckperms.api.actionlog.ActionLogger;
|
||||
import net.luckperms.api.context.ContextCalculator;
|
||||
import net.luckperms.api.context.ContextManager;
|
||||
import net.luckperms.api.context.ContextSetFactory;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.event.EventBus;
|
||||
import net.luckperms.api.messaging.MessagingService;
|
||||
import net.luckperms.api.messenger.MessengerProvider;
|
||||
import net.luckperms.api.metastacking.MetaStackFactory;
|
||||
import net.luckperms.api.model.group.GroupManager;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.model.user.UserManager;
|
||||
import net.luckperms.api.node.NodeBuilderRegistry;
|
||||
import net.luckperms.api.platform.Platform;
|
||||
import net.luckperms.api.platform.PluginMetadata;
|
||||
import net.luckperms.api.query.QueryMode;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
import net.luckperms.api.track.TrackManager;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Implements the LuckPerms API using the plugin instance
|
||||
*/
|
||||
public class MinimalApiProvider implements LuckPerms {
|
||||
public static final MinimalApiProvider INSTANCE = new MinimalApiProvider();
|
||||
|
||||
private MinimalApiProvider() {
|
||||
|
||||
}
|
||||
|
||||
private static UnsupportedOperationException exception() {
|
||||
return new UnsupportedOperationException("API is not fully loaded yet - current implementation is minimal.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull ActionLogger getActionLogger() {
|
||||
return MinimalActionLogger.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull ContextManager getContextManager() {
|
||||
return MinimalContextManager.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull NodeBuilderRegistry getNodeBuilderRegistry() {
|
||||
return ApiNodeBuilderRegistry.INSTANCE;
|
||||
}
|
||||
|
||||
@Override public @NonNull String getServerName() { throw exception(); }
|
||||
@Override public @NonNull UserManager getUserManager() { throw exception(); }
|
||||
@Override public @NonNull GroupManager getGroupManager() { throw exception(); }
|
||||
@Override public @NonNull TrackManager getTrackManager() { throw exception(); }
|
||||
@Override public @NonNull Platform getPlatform() { throw exception(); }
|
||||
@Override public @NonNull PluginMetadata getPluginMetadata() { throw exception(); }
|
||||
@Override public @NonNull EventBus getEventBus() { throw exception(); }
|
||||
@Override public @NonNull Optional<MessagingService> getMessagingService() { throw exception(); }
|
||||
@Override public @NonNull MetaStackFactory getMetaStackFactory() { throw exception(); }
|
||||
@Override public @NonNull CompletableFuture<Void> runUpdateTask() { throw exception(); }
|
||||
@Override public void registerMessengerProvider(@NonNull MessengerProvider messengerProvider) { throw exception(); }
|
||||
@Override public @NonNull Collection<String> getKnownPermissions() { throw exception(); }
|
||||
|
||||
private static final class MinimalActionLogger implements ActionLogger {
|
||||
private static final MinimalActionLogger INSTANCE = new MinimalActionLogger();
|
||||
|
||||
private MinimalActionLogger() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action.@NonNull Builder actionBuilder() {
|
||||
return LoggedAction.build();
|
||||
}
|
||||
|
||||
@Override public @NonNull CompletableFuture<ActionLog> getLog() { throw exception(); }
|
||||
@Override public @NonNull CompletableFuture<Void> submit(@NonNull Action entry) { throw exception(); }
|
||||
@Override public @NonNull CompletableFuture<Void> submitToStorage(@NonNull Action entry) { throw exception(); }
|
||||
@Override public @NonNull CompletableFuture<Void> broadcastAction(@NonNull Action entry) { throw exception(); }
|
||||
}
|
||||
|
||||
private static final class MinimalContextManager implements ContextManager {
|
||||
private static final MinimalContextManager INSTANCE = new MinimalContextManager();
|
||||
|
||||
private MinimalContextManager() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryOptions.@NonNull Builder queryOptionsBuilder(@NonNull QueryMode mode) {
|
||||
Objects.requireNonNull(mode, "mode");
|
||||
return new QueryOptionsBuilderImpl(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull ContextSetFactory getContextSetFactory() {
|
||||
return ApiContextSetFactory.INSTANCE;
|
||||
}
|
||||
|
||||
@Override public @NonNull ImmutableContextSet getContext(@NonNull Object subject) { throw exception(); }
|
||||
@Override public @NonNull Optional<ImmutableContextSet> lookupContext(@NonNull User user) { throw exception(); }
|
||||
@Override public @NonNull ImmutableContextSet getStaticContext() { throw exception(); }
|
||||
@Override public @NonNull QueryOptions getQueryOptions(@NonNull Object subject) { throw exception(); }
|
||||
@Override public @NonNull Optional<QueryOptions> lookupQueryOptions(@NonNull User user) { throw exception(); }
|
||||
@Override public @NonNull QueryOptions getStaticQueryOptions() { throw exception(); }
|
||||
@Override public @NonNull QueryOptions formQueryOptions(@NonNull Object subject, @NonNull ImmutableContextSet contextSet) { throw exception(); }
|
||||
@Override public @NonNull QueryOptions formQueryOptions(@NonNull ImmutableContextSet contextSet) { throw exception(); }
|
||||
@Override public void registerCalculator(@NonNull ContextCalculator<?> calculator) { throw exception(); }
|
||||
@Override public void unregisterCalculator(@NonNull ContextCalculator<?> calculator) { throw exception(); }
|
||||
@Override public void invalidateCache(@NonNull Object subject) { throw exception(); }
|
||||
}
|
||||
|
||||
}
|
@ -27,6 +27,8 @@ package me.lucko.luckperms.common.command.utils;
|
||||
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.commands.user.UserMainCommand;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.context.contextset.MutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
@ -152,7 +154,7 @@ public class ArgumentParser {
|
||||
|
||||
public static MutableContextSet parseContext(int fromIndex, List<String> args, LuckPermsPlugin plugin) throws CommandException {
|
||||
if (args.size() > fromIndex) {
|
||||
MutableContextSet set = MutableContextSet.create();
|
||||
MutableContextSet set = new MutableContextSetImpl();
|
||||
|
||||
List<String> contexts = args.subList(fromIndex, args.size());
|
||||
|
||||
@ -244,10 +246,10 @@ public class ArgumentParser {
|
||||
|
||||
public static ImmutableContextSet parseContextSponge(int fromIndex, List<String> args) {
|
||||
if (args.size() <= fromIndex) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
|
||||
MutableContextSet contextSet = MutableContextSet.create();
|
||||
MutableContextSet contextSet = new MutableContextSetImpl();
|
||||
List<String> toQuery = args.subList(fromIndex, args.size());
|
||||
for (String s : toQuery) {
|
||||
int index = s.indexOf('=');
|
||||
|
@ -32,6 +32,7 @@ import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.message.Message;
|
||||
@ -48,7 +49,6 @@ import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.event.ClickEvent;
|
||||
import net.kyori.text.event.HoverEvent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -66,7 +66,7 @@ public class HolderEditor<T extends PermissionHolder> extends SubCommand<T> {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, T holder, List<String> args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), holder) || ArgumentPermissions.checkGroup(plugin, sender, holder, ImmutableContextSet.empty())) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), holder) || ArgumentPermissions.checkGroup(plugin, sender, holder, ImmutableContextSetImpl.EMPTY)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import me.lucko.luckperms.common.command.tabcomplete.TabCompleter;
|
||||
import me.lucko.luckperms.common.command.tabcomplete.TabCompletions;
|
||||
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.message.Message;
|
||||
@ -45,7 +46,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.model.DataType;
|
||||
import net.luckperms.api.node.Node;
|
||||
import net.luckperms.api.node.NodeEqualityPredicate;
|
||||
@ -80,9 +80,9 @@ public class UserSwitchPrimaryGroup extends SharedSubCommand {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, ImmutableContextSet.empty()) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, holder, ImmutableContextSet.empty()) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, group, ImmutableContextSet.empty()) ||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, ImmutableContextSetImpl.EMPTY) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, holder, ImmutableContextSetImpl.EMPTY) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, group, ImmutableContextSetImpl.EMPTY) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, group.getName())) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
|
@ -29,6 +29,7 @@ import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.message.Message;
|
||||
@ -38,7 +39,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.model.DataType;
|
||||
import net.luckperms.api.node.Node;
|
||||
|
||||
@ -59,7 +59,7 @@ public class LogNotify extends SubCommand<Log> {
|
||||
return false;
|
||||
}
|
||||
|
||||
Optional<? extends Node> ret = user.normalData().immutable().get(ImmutableContextSet.empty()).stream()
|
||||
Optional<? extends Node> ret = user.normalData().immutable().get(ImmutableContextSetImpl.EMPTY).stream()
|
||||
.filter(n -> n.getKey().equalsIgnoreCase(IGNORE_NODE))
|
||||
.findFirst();
|
||||
|
||||
@ -79,7 +79,7 @@ public class LogNotify extends SubCommand<Log> {
|
||||
user.setPermission(DataType.NORMAL, NodeFactory.make(IGNORE_NODE), true);
|
||||
} else {
|
||||
// remove the perm
|
||||
user.removeIf(DataType.NORMAL, ImmutableContextSet.empty(), n -> n.getKey().equalsIgnoreCase(IGNORE_NODE), null);
|
||||
user.removeIf(DataType.NORMAL, ImmutableContextSetImpl.EMPTY, n -> n.getKey().equalsIgnoreCase(IGNORE_NODE), null);
|
||||
}
|
||||
|
||||
plugin.getStorage().saveUser(user).join();
|
||||
|
@ -28,6 +28,7 @@ package me.lucko.luckperms.common.config;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.graph.TraversalAlgorithm;
|
||||
import me.lucko.luckperms.common.metastacking.SimpleMetaStackDefinition;
|
||||
import me.lucko.luckperms.common.metastacking.StandardStackElements;
|
||||
@ -41,7 +42,6 @@ import me.lucko.luckperms.common.storage.implementation.split.SplitStorageType;
|
||||
import me.lucko.luckperms.common.storage.misc.StorageCredentials;
|
||||
import me.lucko.luckperms.common.util.ImmutableCollectors;
|
||||
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.metastacking.DuplicateRemovalFunction;
|
||||
import net.luckperms.api.metastacking.MetaStackDefinition;
|
||||
import net.luckperms.api.model.TemporaryMergeBehaviour;
|
||||
@ -108,7 +108,7 @@ public final class ConfigKeys {
|
||||
if (c.getBoolean("apply-global-world-groups", true)) {
|
||||
flags.add(Flag.APPLY_INHERITANCE_NODES_WITHOUT_WORLD_CONTEXT);
|
||||
}
|
||||
return QueryOptions.contextual(ImmutableContextSet.empty(), flags);
|
||||
return QueryOptions.contextual(ImmutableContextSetImpl.EMPTY, flags);
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.lucko.luckperms.common.context.ContextSetJsonSerializer;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.util.gson.GsonProvider;
|
||||
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
@ -46,8 +47,8 @@ import java.nio.file.Path;
|
||||
public class ContextsFile {
|
||||
private final LuckPermsConfiguration configuration;
|
||||
|
||||
private ImmutableContextSet staticContexts = ImmutableContextSet.empty();
|
||||
private ImmutableContextSet defaultContexts = ImmutableContextSet.empty();
|
||||
private ImmutableContextSet staticContexts = ImmutableContextSetImpl.EMPTY;
|
||||
private ImmutableContextSet defaultContexts = ImmutableContextSetImpl.EMPTY;
|
||||
|
||||
public ContextsFile(LuckPermsConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
|
@ -29,6 +29,7 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.common.cache.ExpiringCache;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import net.luckperms.api.context.ContextCalculator;
|
||||
@ -119,7 +120,7 @@ public abstract class ContextManager<T> {
|
||||
}
|
||||
|
||||
protected QueryOptions calculate(T subject) {
|
||||
ImmutableContextSet.Builder accumulator = ImmutableContextSet.builder();
|
||||
ImmutableContextSet.Builder accumulator = new ImmutableContextSetImpl.BuilderImpl();
|
||||
|
||||
for (ContextCalculator<? super T> calculator : this.calculators) {
|
||||
try {
|
||||
@ -134,7 +135,7 @@ public abstract class ContextManager<T> {
|
||||
}
|
||||
|
||||
QueryOptions calculateStatic() {
|
||||
ImmutableContextSet.Builder accumulator = ImmutableContextSet.builder();
|
||||
ImmutableContextSet.Builder accumulator = new ImmutableContextSetImpl.BuilderImpl();
|
||||
|
||||
for (StaticContextCalculator calculator : this.staticCalculators) {
|
||||
try {
|
||||
|
@ -27,8 +27,10 @@ package me.lucko.luckperms.common.context;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.context.contextset.MutableContextSetImpl;
|
||||
|
||||
import net.luckperms.api.context.ContextSet;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.context.MutableContextSet;
|
||||
|
||||
import ninja.leaping.configurate.ConfigurationNode;
|
||||
@ -65,10 +67,10 @@ public final class ContextSetConfigurateSerializer {
|
||||
Map<Object, ? extends ConfigurationNode> dataMap = data.getChildrenMap();
|
||||
|
||||
if (dataMap.isEmpty()) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
|
||||
MutableContextSet map = MutableContextSet.create();
|
||||
MutableContextSet map = new MutableContextSetImpl();
|
||||
for (Map.Entry<Object, ? extends ConfigurationNode> e : dataMap.entrySet()) {
|
||||
String k = e.getKey().toString();
|
||||
ConfigurationNode v = e.getValue();
|
||||
|
@ -32,8 +32,10 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.context.contextset.MutableContextSetImpl;
|
||||
|
||||
import net.luckperms.api.context.ContextSet;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.context.MutableContextSet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -70,12 +72,12 @@ public final class ContextSetJsonSerializer {
|
||||
public static ContextSet deserializeContextSet(Gson gson, String json) {
|
||||
Objects.requireNonNull(json, "json");
|
||||
if (json.equals("{}")) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
|
||||
JsonObject context = gson.fromJson(json, JsonObject.class);
|
||||
if (context == null) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
|
||||
return deserializeContextSet(context);
|
||||
@ -86,10 +88,10 @@ public final class ContextSetJsonSerializer {
|
||||
JsonObject data = element.getAsJsonObject();
|
||||
|
||||
if (data.entrySet().isEmpty()) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
|
||||
MutableContextSet map = MutableContextSet.create();
|
||||
MutableContextSet map = new MutableContextSetImpl();
|
||||
for (Map.Entry<String, JsonElement> e : data.entrySet()) {
|
||||
String k = e.getKey();
|
||||
JsonElement v = e.getValue();
|
||||
|
@ -80,7 +80,7 @@ public final class MutableContextSetImpl extends AbstractContextSet implements M
|
||||
public @NonNull ImmutableContextSet immutableCopy() {
|
||||
// if the map is empty, don't create a new instance
|
||||
if (this.map.isEmpty()) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
synchronized (this.map) {
|
||||
return new ImmutableContextSetImpl(ImmutableSetMultimap.copyOf(this.map));
|
||||
|
@ -28,13 +28,13 @@ package me.lucko.luckperms.common.model.manager.user;
|
||||
import com.google.common.collect.ImmutableCollection;
|
||||
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.model.UserIdentifier;
|
||||
import me.lucko.luckperms.common.model.manager.AbstractManager;
|
||||
import me.lucko.luckperms.common.node.factory.NodeFactory;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.model.DataType;
|
||||
import net.luckperms.api.node.Node;
|
||||
import net.luckperms.api.node.NodeType;
|
||||
@ -91,7 +91,7 @@ public abstract class AbstractUserManager<T extends User> extends AbstractManage
|
||||
String pg = user.getPrimaryGroup().getValue();
|
||||
boolean has = false;
|
||||
|
||||
for (Node node : user.normalData().immutable().get(ImmutableContextSet.empty())) {
|
||||
for (Node node : user.normalData().immutable().get(ImmutableContextSetImpl.EMPTY)) {
|
||||
if (node instanceof InheritanceNode && ((InheritanceNode) node).getGroupName().equalsIgnoreCase(pg)) {
|
||||
has = true;
|
||||
break;
|
||||
@ -100,7 +100,7 @@ public abstract class AbstractUserManager<T extends User> extends AbstractManage
|
||||
|
||||
// need to find a new primary group for the user.
|
||||
if (!has) {
|
||||
String group = user.normalData().immutable().get(ImmutableContextSet.empty()).stream()
|
||||
String group = user.normalData().immutable().get(ImmutableContextSetImpl.EMPTY).stream()
|
||||
.filter(NodeType.INHERITANCE::matches)
|
||||
.map(NodeType.INHERITANCE::cast)
|
||||
.findFirst()
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.common.node;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
|
||||
import net.luckperms.api.context.ContextSet;
|
||||
import net.luckperms.api.context.DefaultContextKeys;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
@ -50,14 +52,14 @@ public abstract class AbstractNodeBuilder<N extends ScopedNode<N, B>, B extends
|
||||
protected AbstractNodeBuilder() {
|
||||
this.value = true;
|
||||
this.expireAt = 0L;
|
||||
this.context = ImmutableContextSet.builder();
|
||||
this.context = new ImmutableContextSetImpl.BuilderImpl();
|
||||
this.metadata = new IdentityHashMap<>();
|
||||
}
|
||||
|
||||
protected AbstractNodeBuilder(boolean value, long expireAt, ImmutableContextSet context, Map<NodeMetadataKey<?>, Object> metadata) {
|
||||
this.value = value;
|
||||
this.expireAt = expireAt;
|
||||
this.context = ImmutableContextSet.builder().addAll(context);
|
||||
this.context = new ImmutableContextSetImpl.BuilderImpl().addAll(context);
|
||||
this.metadata = new IdentityHashMap<>(metadata);
|
||||
}
|
||||
|
||||
@ -98,7 +100,7 @@ public abstract class AbstractNodeBuilder<N extends ScopedNode<N, B>, B extends
|
||||
@Override
|
||||
public @NonNull B context(@NonNull ContextSet contextSet) {
|
||||
Objects.requireNonNull(contextSet, "contextSet");
|
||||
this.context = ImmutableContextSet.builder().addAll(contextSet);
|
||||
this.context = new ImmutableContextSetImpl.BuilderImpl().addAll(contextSet);
|
||||
return (B) this;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ package me.lucko.luckperms.common.node.factory;
|
||||
import com.google.common.base.Splitter;
|
||||
|
||||
import me.lucko.luckperms.common.cache.PatternCache;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.node.types.DisplayName;
|
||||
import me.lucko.luckperms.common.node.types.Inheritance;
|
||||
import me.lucko.luckperms.common.node.types.Meta;
|
||||
@ -104,10 +105,10 @@ public final class NodeTypes {
|
||||
|
||||
private static ImmutableContextSet formContextSet(ContextSet contexts, String server, String world) {
|
||||
if ((contexts == null || contexts.isEmpty()) && server == null && world == null) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
|
||||
ImmutableContextSet.Builder builder = ImmutableContextSet.builder();
|
||||
ImmutableContextSet.Builder builder = new ImmutableContextSetImpl.BuilderImpl();
|
||||
|
||||
if (contexts != null) {
|
||||
builder.addAll(contexts);
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.common.node.model;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.node.factory.NodeFactory;
|
||||
|
||||
import net.luckperms.api.context.ContextSet;
|
||||
@ -85,7 +86,7 @@ public final class NodeDataContainer {
|
||||
}
|
||||
|
||||
public static NodeDataContainer of(String permission) {
|
||||
return of(permission, true, "global", "global", 0L, ImmutableContextSet.empty());
|
||||
return of(permission, true, "global", "global", 0L, ImmutableContextSetImpl.EMPTY);
|
||||
}
|
||||
|
||||
private final String permission;
|
||||
|
@ -28,6 +28,7 @@ package me.lucko.luckperms.common.plugin;
|
||||
import me.lucko.luckperms.common.actionlog.LogDispatcher;
|
||||
import me.lucko.luckperms.common.api.ApiRegistrationUtil;
|
||||
import me.lucko.luckperms.common.api.LuckPermsApiProvider;
|
||||
import me.lucko.luckperms.common.api.MinimalApiProvider;
|
||||
import me.lucko.luckperms.common.calculator.CalculatorFactory;
|
||||
import me.lucko.luckperms.common.config.AbstractConfiguration;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
@ -103,6 +104,9 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin {
|
||||
// send the startup banner
|
||||
displayBanner(getConsoleSender());
|
||||
|
||||
// minimal api
|
||||
ApiRegistrationUtil.registerProvider(MinimalApiProvider.INSTANCE);
|
||||
|
||||
// load some utilities early
|
||||
this.verboseHandler = new VerboseHandler(getBootstrap().getScheduler());
|
||||
this.permissionRegistry = new PermissionRegistry(getBootstrap().getScheduler());
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.common.query;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
|
||||
import net.luckperms.api.context.ContextSet;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.query.Flag;
|
||||
@ -51,7 +53,7 @@ public class QueryOptionsBuilderImpl implements QueryOptions.Builder {
|
||||
|
||||
public QueryOptionsBuilderImpl(QueryMode mode) {
|
||||
this.mode = mode;
|
||||
this.context = mode == QueryMode.CONTEXTUAL ? ImmutableContextSet.empty() : null;
|
||||
this.context = mode == QueryMode.CONTEXTUAL ? ImmutableContextSetImpl.EMPTY : null;
|
||||
this.flags = 0;
|
||||
this.flagsSet = null;
|
||||
this.options = null;
|
||||
@ -74,7 +76,7 @@ public class QueryOptionsBuilderImpl implements QueryOptions.Builder {
|
||||
}
|
||||
|
||||
this.mode = mode;
|
||||
this.context = this.mode == QueryMode.CONTEXTUAL ? ImmutableContextSet.empty() : null;
|
||||
this.context = this.mode == QueryMode.CONTEXTUAL ? ImmutableContextSetImpl.EMPTY : null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -149,14 +151,16 @@ public class QueryOptionsBuilderImpl implements QueryOptions.Builder {
|
||||
if (this.options == null) {
|
||||
if (this.mode == QueryMode.NON_CONTEXTUAL) {
|
||||
QueryOptionsImpl defaults = (QueryOptionsImpl) QueryOptions.nonContextual();
|
||||
if (defaults.getFlagsByte() == flags) {
|
||||
//noinspection ConstantConditions
|
||||
if (defaults != null && defaults.getFlagsByte() == flags) {
|
||||
// mode same, contexts null, flags same, options null
|
||||
// so therefore, equal to default - return that instead!
|
||||
return defaults;
|
||||
}
|
||||
} else if (this.mode == QueryMode.CONTEXTUAL) {
|
||||
QueryOptionsImpl defaults = (QueryOptionsImpl) QueryOptions.defaultContextualOptions();
|
||||
if (defaults.getFlagsByte() == flags && this.context.isEmpty()) {
|
||||
//noinspection ConstantConditions
|
||||
if (defaults != null && defaults.getFlagsByte() == flags && this.context.isEmpty()) {
|
||||
// mode same, contexts empty, flags same, options null
|
||||
// so therefore, equal to default - return that instead!
|
||||
return defaults;
|
||||
|
@ -32,6 +32,7 @@ import com.google.common.collect.Maps;
|
||||
import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.bulkupdate.BulkUpdate;
|
||||
import me.lucko.luckperms.common.context.ContextSetConfigurateSerializer;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.Track;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
@ -462,7 +463,7 @@ public abstract class AbstractConfigurateStorage implements StorageImplementatio
|
||||
String world = attributes.getNode("world").getString("global");
|
||||
long expiry = attributes.getNode("expiry").getLong(0L);
|
||||
|
||||
ImmutableContextSet context = ImmutableContextSet.empty();
|
||||
ImmutableContextSet context = ImmutableContextSetImpl.EMPTY;
|
||||
ConfigurationNode contextMap = attributes.getNode("context");
|
||||
if (!contextMap.isVirtual() && contextMap.hasMapChildren()) {
|
||||
context = ContextSetConfigurateSerializer.deserializeContextSet(contextMap).immutableCopy();
|
||||
@ -477,7 +478,7 @@ public abstract class AbstractConfigurateStorage implements StorageImplementatio
|
||||
String world = attributes.getNode("world").getString("global");
|
||||
long expiry = attributes.getNode("expiry").getLong(0L);
|
||||
|
||||
ImmutableContextSet context = ImmutableContextSet.empty();
|
||||
ImmutableContextSet context = ImmutableContextSetImpl.EMPTY;
|
||||
ConfigurationNode contextMap = attributes.getNode("context");
|
||||
if (!contextMap.isVirtual() && contextMap.hasMapChildren()) {
|
||||
context = ContextSetConfigurateSerializer.deserializeContextSet(contextMap).immutableCopy();
|
||||
|
@ -41,6 +41,8 @@ import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.bulkupdate.BulkUpdate;
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.Constraint;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.context.contextset.MutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.Track;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
@ -734,7 +736,7 @@ public class MongoStorage implements StorageImplementation {
|
||||
String server = "global";
|
||||
String world = "global";
|
||||
long expiry = 0L;
|
||||
ImmutableContextSet context = ImmutableContextSet.empty();
|
||||
ImmutableContextSet context = ImmutableContextSetImpl.EMPTY;
|
||||
|
||||
if (document.containsKey("value")) {
|
||||
value = document.getBoolean("value");
|
||||
@ -767,7 +769,7 @@ public class MongoStorage implements StorageImplementation {
|
||||
}
|
||||
|
||||
private static MutableContextSet docsToContextSet(List<Document> documents) {
|
||||
MutableContextSet map = MutableContextSet.create();
|
||||
MutableContextSet map = new MutableContextSetImpl();
|
||||
for (Document doc : documents) {
|
||||
map.add(doc.getString("key"), doc.getString("value"));
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ shadowJar {
|
||||
archiveName = "LuckPerms-Nukkit-${project.ext.fullVersion}.jar"
|
||||
|
||||
dependencies {
|
||||
include(dependency('net.luckperms:.*'))
|
||||
include(dependency('me.lucko.luckperms:.*'))
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ shadowJar {
|
||||
archiveName = "LuckPerms-Sponge-${project.ext.fullVersion}.jar"
|
||||
|
||||
dependencies {
|
||||
include(dependency('net.luckperms:.*'))
|
||||
include(dependency('me.lucko.luckperms:.*'))
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,13 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.service.proxy.api6;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionDescription;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectCollection;
|
||||
import me.lucko.luckperms.sponge.service.model.ProxiedServiceObject;
|
||||
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.node.Tristate;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@ -97,7 +97,7 @@ public final class DescriptionBuilder implements PermissionDescription.Builder,
|
||||
LPSubjectCollection subjects = this.service.getCollection(PermissionService.SUBJECTS_ROLE_TEMPLATE);
|
||||
for (Map.Entry<String, Tristate> assignment : this.roles.entrySet()) {
|
||||
LPSubject roleSubject = subjects.loadSubject(assignment.getKey()).join();
|
||||
roleSubject.getTransientSubjectData().setPermission(ImmutableContextSet.empty(), this.id, assignment.getValue());
|
||||
roleSubject.getTransientSubjectData().setPermission(ImmutableContextSetImpl.EMPTY, this.id, assignment.getValue());
|
||||
}
|
||||
|
||||
// null stuff so this instance can be reused
|
||||
|
@ -25,13 +25,13 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.service.proxy.api7;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionDescription;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectCollection;
|
||||
import me.lucko.luckperms.sponge.service.model.ProxiedServiceObject;
|
||||
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.node.Tristate;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@ -96,7 +96,7 @@ public final class DescriptionBuilder implements PermissionDescription.Builder,
|
||||
LPSubjectCollection subjects = this.service.getCollection(PermissionService.SUBJECTS_ROLE_TEMPLATE);
|
||||
for (Map.Entry<String, Tristate> assignment : this.roles.entrySet()) {
|
||||
LPSubject roleSubject = subjects.loadSubject(assignment.getKey()).join();
|
||||
roleSubject.getTransientSubjectData().setPermission(ImmutableContextSet.empty(), this.id, assignment.getValue());
|
||||
roleSubject.getTransientSubjectData().setPermission(ImmutableContextSetImpl.EMPTY, this.id, assignment.getValue());
|
||||
}
|
||||
|
||||
// null stuff so this instance can be reused
|
||||
|
@ -28,6 +28,7 @@ package me.lucko.luckperms.sponge.service;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import me.lucko.luckperms.common.context.contextset.ContextImpl;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.sponge.service.context.DelegatingContextSet;
|
||||
import me.lucko.luckperms.sponge.service.context.DelegatingImmutableContextSet;
|
||||
|
||||
@ -57,10 +58,10 @@ public final class CompatibilityUtil {
|
||||
}
|
||||
|
||||
if (contexts.isEmpty()) {
|
||||
return ImmutableContextSet.empty();
|
||||
return ImmutableContextSetImpl.EMPTY;
|
||||
}
|
||||
|
||||
ImmutableContextSet.Builder builder = ImmutableContextSet.builder();
|
||||
ImmutableContextSet.Builder builder = new ImmutableContextSetImpl.BuilderImpl();
|
||||
for (Map.Entry<String, String> entry : contexts) {
|
||||
builder.add(new ContextImpl(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.Constraint;
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.StandardComparison;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.model.manager.group.AbstractGroupManager;
|
||||
import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
||||
import me.lucko.luckperms.common.util.ImmutableCollectors;
|
||||
@ -194,7 +195,7 @@ public class SpongeGroupManager extends AbstractGroupManager<SpongeGroup> implem
|
||||
|
||||
List<HeldNode<String>> lookup = this.plugin.getStorage().getGroupsWithPermission(Constraint.of(StandardComparison.EQUAL, permission)).join();
|
||||
for (HeldNode<String> holder : lookup) {
|
||||
if (holder.getNode().getContexts().equals(ImmutableContextSet.empty())) {
|
||||
if (holder.getNode().getContexts().equals(ImmutableContextSetImpl.EMPTY)) {
|
||||
ret.put(getService().getReferenceFactory().obtain(getIdentifier(), holder.getHolder()), holder.getNode().getValue());
|
||||
}
|
||||
}
|
||||
@ -223,7 +224,7 @@ public class SpongeGroupManager extends AbstractGroupManager<SpongeGroup> implem
|
||||
public ImmutableMap<LPSubject, Boolean> getLoadedWithPermission(String permission) {
|
||||
return getAll().values().stream()
|
||||
.map(SpongeGroup::sponge)
|
||||
.map(sub -> Maps.immutableEntry(sub, sub.getPermissionValue(ImmutableContextSet.empty(), permission)))
|
||||
.map(sub -> Maps.immutableEntry(sub, sub.getPermissionValue(ImmutableContextSetImpl.EMPTY, permission)))
|
||||
.filter(pair -> pair.getValue() != Tristate.UNDEFINED)
|
||||
.collect(ImmutableCollectors.toMap(Map.Entry::getKey, sub -> sub.getValue().asBoolean()));
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.Constraint;
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.StandardComparison;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.model.UserIdentifier;
|
||||
import me.lucko.luckperms.common.model.manager.user.AbstractUserManager;
|
||||
import me.lucko.luckperms.common.model.manager.user.UserHousekeeper;
|
||||
@ -216,7 +217,7 @@ public class SpongeUserManager extends AbstractUserManager<SpongeUser> implement
|
||||
|
||||
List<HeldNode<UUID>> lookup = this.plugin.getStorage().getUsersWithPermission(Constraint.of(StandardComparison.EQUAL, permission)).join();
|
||||
for (HeldNode<UUID> holder : lookup) {
|
||||
if (holder.getNode().getContexts().equals(ImmutableContextSet.empty())) {
|
||||
if (holder.getNode().getContexts().equals(ImmutableContextSetImpl.EMPTY)) {
|
||||
ret.put(getService().getReferenceFactory().obtain(getIdentifier(), holder.getHolder().toString()), holder.getNode().getValue());
|
||||
}
|
||||
}
|
||||
@ -245,7 +246,7 @@ public class SpongeUserManager extends AbstractUserManager<SpongeUser> implement
|
||||
public ImmutableMap<LPSubject, Boolean> getLoadedWithPermission(String permission) {
|
||||
return getAll().values().stream()
|
||||
.map(SpongeUser::sponge)
|
||||
.map(sub -> Maps.immutableEntry(sub, sub.getPermissionValue(ImmutableContextSet.empty(), permission)))
|
||||
.map(sub -> Maps.immutableEntry(sub, sub.getPermissionValue(ImmutableContextSetImpl.EMPTY, permission)))
|
||||
.filter(pair -> pair.getValue() != Tristate.UNDEFINED)
|
||||
.collect(ImmutableCollectors.toMap(Map.Entry::getKey, sub -> sub.getValue().asBoolean()));
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import me.lucko.luckperms.common.cache.LoadingMap;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
import me.lucko.luckperms.common.util.ImmutableCollectors;
|
||||
import me.lucko.luckperms.common.util.Predicates;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
@ -175,7 +176,7 @@ public class PersistedCollection implements LPSubjectCollection {
|
||||
public ImmutableMap<LPSubject, Boolean> getLoadedWithPermission(String permission) {
|
||||
ImmutableMap.Builder<LPSubject, Boolean> m = ImmutableMap.builder();
|
||||
for (LPSubject subject : this.subjects.values()) {
|
||||
Tristate ts = subject.getPermissionValue(ImmutableContextSet.empty(), permission);
|
||||
Tristate ts = subject.getPermissionValue(ImmutableContextSetImpl.EMPTY, permission);
|
||||
if (ts != Tristate.UNDEFINED) {
|
||||
m.put(subject, ts.asBoolean());
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ shadowJar {
|
||||
archiveName = "LuckPerms-Velocity-${project.ext.fullVersion}.jar"
|
||||
|
||||
dependencies {
|
||||
include(dependency('net.luckperms:.*'))
|
||||
include(dependency('me.lucko.luckperms:.*'))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user