net.luckperms.api.LuckPermsProvider Java Examples

The following examples show how to use net.luckperms.api.LuckPermsProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PermissionsManagerInitializationTest.java    From AuthMeReloaded with GNU General Public License v3.0 6 votes vote down vote up
private void setUpForPermissionSystemTest() {
    if (permissionsSystemType == LUCK_PERMS) {
        LuckPerms api = mock(LuckPerms.class);
        ReflectionTestUtils.setField(LuckPermsProvider.class, null, "instance", api);
    } else if (permissionsSystemType == PERMISSIONS_EX) {
        throw new AssumptionViolatedException(
            "PermissionsEx instance cannot be mocked because of missing dependencies -- skipping");
    } else if (permissionsSystemType == Z_PERMISSIONS) {
        ZPermissionsService zPermissionsService = mock(ZPermissionsService.class);
        given(servicesManager.load(ZPermissionsService.class)).willReturn(zPermissionsService);
    } else if (permissionsSystemType == VAULT) {
        setUpForVault();
    } else {
        throw new IllegalStateException("Unhandled permission systems type: " + permissionsSystemType);
    }
}
 
Example #2
Source File: LuckPermsBridge.java    From LunaChat with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * LuckPermsをロードする
 * @param plugin LuckPermsのインスタンス
 * @return ロードされたLuckPermsBridge
 */
public static LuckPermsBridge load(Plugin plugin) {

    // LuckPermsが指定されたかどうかを確認
    if ( plugin == null ) return null;

    // ロードされているならLuckPermsBridgeのインスタンスを作成して返す
    return new LuckPermsBridge(LuckPermsProvider.get());
}
 
Example #3
Source File: LuckPermsHandler.java    From AuthMeReloaded with GNU General Public License v3.0 5 votes vote down vote up
public LuckPermsHandler() throws PermissionHandlerException {
    try {
        luckPerms = LuckPermsProvider.get();
    } catch (IllegalStateException e) {
        throw new PermissionHandlerException("Could not get api of LuckPerms", e);
    }
}
 
Example #4
Source File: HookLuckPerms.java    From NametagEdit with GNU General Public License v3.0 4 votes vote down vote up
public HookLuckPerms(NametagHandler handler) {
    this.handler = handler;
    LuckPerms api = LuckPermsProvider.get();
    EventBus eventBus = api.getEventBus();
    eventBus.subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculateEvent);
}
 
Example #5
Source File: WeightNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link WeightNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forWeight();
}
 
Example #6
Source File: Node.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Gets a {@link NodeBuilder} for the given node {@link #getKey() key}.
 *
 * @param key the key
 * @return the node builder
 */
static @NonNull NodeBuilder<?, ?> builder(@NonNull String key) {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forKey(key);
}
 
Example #7
Source File: PermissionNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link PermissionNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forPermission();
}
 
Example #8
Source File: SuffixNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link SuffixNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forSuffix();
}
 
Example #9
Source File: MetaNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link MetaNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forMeta();
}
 
Example #10
Source File: PrefixNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link PrefixNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forPrefix();
}
 
Example #11
Source File: RegexPermissionNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link RegexPermissionNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forRegexPermission();
}
 
Example #12
Source File: DisplayNameNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link DisplayNameNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forDisplayName();
}
 
Example #13
Source File: InheritanceNode.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a {@link InheritanceNode} builder.
 *
 * @return the builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getNodeBuilderRegistry().forInheritance();
}
 
Example #14
Source File: NodeMatcher.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Gets a {@link NodeMatcher} which matches nodes which are
 * {@link Node#equals(Node, NodeEqualityPredicate) equal to} the given {@code other} node
 * according to the {@link NodeEqualityPredicate}.
 *
 * @param other the other node to test against
 * @param equalityPredicate the equality predicate
 * @param <T> the node type
 * @return the matcher
 */
static <T extends Node> @NonNull NodeMatcher<T> equals(@NonNull T other, @NonNull NodeEqualityPredicate equalityPredicate) {
    return LuckPermsProvider.get().getNodeMatcherFactory().equals(other, equalityPredicate);
}
 
Example #15
Source File: NodeMatcher.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Gets a {@link NodeMatcher} which matches nodes with a {@link Node#getKey() key} starting
 * with the given string.
 *
 * @param startingWith the string to match
 * @return the matcher
 */
static @NonNull NodeMatcher<Node> keyStartsWith(@NonNull String startingWith) {
    return LuckPermsProvider.get().getNodeMatcherFactory().keyStartsWith(startingWith);
}
 
Example #16
Source File: NodeMatcher.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Gets a {@link NodeMatcher} which matches nodes with the same {@link Node#getKey() key}.
 *
 * <p>The {@link String#equalsIgnoreCase(String)} method is used to test key equality.</p>
 *
 * @param node the node to use for the key
 * @param <T> the node type
 * @return the matcher
 */
static <T extends Node> @NonNull NodeMatcher<T> key(@NonNull T node) {
    return LuckPermsProvider.get().getNodeMatcherFactory().key(node);
}
 
Example #17
Source File: Action.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Gets a {@link Action.Builder}
 *
 * @return a new builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getActionLogger().actionBuilder();
}
 
Example #18
Source File: MutableContextSet.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a new empty MutableContextSet.
 *
 * @return a new MutableContextSet
 */
static @NonNull MutableContextSet create() {
    return LuckPermsProvider.get().getContextManager().getContextSetFactory().mutable();
}
 
Example #19
Source File: ImmutableContextSet.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates an {@link ImmutableContextSet} from a context pair.
 *
 * @param key   the key
 * @param value the value
 * @return a new ImmutableContextSet containing one context pair
 * @throws NullPointerException if key or value is null
 */
static @NonNull ImmutableContextSet of(@NonNull String key, @NonNull String value) {
    return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableOf(key, value);
}
 
Example #20
Source File: ImmutableContextSet.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Returns an empty {@link ImmutableContextSet}.
 *
 * @return an empty ImmutableContextSet
 */
static @NonNull ImmutableContextSet empty() {
    return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableEmpty();
}
 
Example #21
Source File: ImmutableContextSet.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates an {@link ImmutableContextSet.Builder}.
 *
 * @return a new ImmutableContextSet builder
 */
static @NonNull Builder builder() {
    return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableBuilder();
}
 
Example #22
Source File: QueryOptions.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Gets the default {@link QueryMode#CONTEXTUAL contextual}
 * query options.
 *
 * <p>This instance has the default set of flags, and an empty set
 * of contexts.</p>
 *
 * @return the default contextual query options
 */
static @NonNull QueryOptions defaultContextualOptions() {
    return LuckPermsProvider.get().getQueryOptionsRegistry().defaultContextualOptions();
}
 
Example #23
Source File: QueryOptions.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Gets the default {@link QueryMode#NON_CONTEXTUAL non contextual}
 * query options.
 *
 * <p>This instance has the default set of flags.</p>
 *
 * @return the default non contextual query options
 */
static @NonNull QueryOptions nonContextual() {
    return LuckPermsProvider.get().getQueryOptionsRegistry().defaultNonContextualOptions();
}
 
Example #24
Source File: QueryOptions.java    From LuckPerms with MIT License 2 votes vote down vote up
/**
 * Creates a new {@link Builder} for the given {@link QueryMode}.
 *
 * @param mode the query mode
 * @return a new builder
 */
static @NonNull Builder builder(@NonNull QueryMode mode) {
    return LuckPermsProvider.get().getContextManager().queryOptionsBuilder(mode);
}