mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-09-09 05:40:47 +02:00
Fix MetaValueSelector NPE
This commit is contained in:
61
api/src/main/java/net/luckperms/api/cacheddata/Result.java
Normal file
61
api/src/main/java/net/luckperms/api/cacheddata/Result.java
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.node.Node;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the result of a cached data lookup
|
||||
*
|
||||
* @param <T> the result type
|
||||
* @since 5.4
|
||||
*/
|
||||
public interface Result<T, N extends Node> {
|
||||
|
||||
/**
|
||||
* Gets the underlying result.
|
||||
*
|
||||
* @return the underlying result
|
||||
*/
|
||||
T result();
|
||||
|
||||
/**
|
||||
* Gets the node that caused the result.
|
||||
*
|
||||
* @return the causing node
|
||||
*/
|
||||
@Nullable N node();
|
||||
|
||||
/**
|
||||
* Gets the result that this result overrides, if applicable.
|
||||
*
|
||||
* @return the overridden result
|
||||
*/
|
||||
@Nullable Result<T, N> overriddenResult();
|
||||
|
||||
}
|
@@ -25,6 +25,7 @@
|
||||
|
||||
package net.luckperms.api.query.meta;
|
||||
|
||||
import net.luckperms.api.cacheddata.Result;
|
||||
import net.luckperms.api.node.types.MetaNode;
|
||||
import net.luckperms.api.query.OptionKey;
|
||||
|
||||
@@ -54,6 +55,6 @@ public interface MetaValueSelector {
|
||||
* @param values the values, in the order in which they were accumulated.
|
||||
* @return the selected value
|
||||
*/
|
||||
@NonNull MetaNode selectValue(@NonNull String key, @NonNull List<MetaNode> values);
|
||||
@NonNull Result<String, MetaNode> selectValue(@NonNull String key, @NonNull List<? extends Result<String, MetaNode>> values);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user