1
0
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:
Luck
2021-12-31 17:50:42 +00:00
parent d319d8dc52
commit acdc259771
8 changed files with 22 additions and 17 deletions

View 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();
}

View File

@@ -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);
}