diff --git a/common/src/main/java/me/lucko/luckperms/common/node/types/Inheritance.java b/common/src/main/java/me/lucko/luckperms/common/node/types/Inheritance.java index 6bf1c09ce..ba0d182ac 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/types/Inheritance.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/types/Inheritance.java @@ -27,10 +27,12 @@ package me.lucko.luckperms.common.node.types; import me.lucko.luckperms.common.node.AbstractNode; import me.lucko.luckperms.common.node.AbstractNodeBuilder; + import net.luckperms.api.context.ImmutableContextSet; import net.luckperms.api.model.group.Group; import net.luckperms.api.node.metadata.NodeMetadataKey; import net.luckperms.api.node.types.InheritanceNode; + import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/common/src/main/java/me/lucko/luckperms/common/node/types/Meta.java b/common/src/main/java/me/lucko/luckperms/common/node/types/Meta.java index cfebd298b..d21a24a97 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/types/Meta.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/types/Meta.java @@ -28,9 +28,11 @@ package me.lucko.luckperms.common.node.types; import me.lucko.luckperms.common.node.AbstractNode; import me.lucko.luckperms.common.node.AbstractNodeBuilder; import me.lucko.luckperms.common.node.factory.Delimiters; + import net.luckperms.api.context.ImmutableContextSet; import net.luckperms.api.node.metadata.NodeMetadataKey; import net.luckperms.api.node.types.MetaNode; + import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/common/src/main/java/me/lucko/luckperms/common/query/FlagUtils.java b/common/src/main/java/me/lucko/luckperms/common/query/FlagUtils.java index a2e73a661..a27f896fe 100644 --- a/common/src/main/java/me/lucko/luckperms/common/query/FlagUtils.java +++ b/common/src/main/java/me/lucko/luckperms/common/query/FlagUtils.java @@ -33,9 +33,9 @@ import java.util.Set; final class FlagUtils { private FlagUtils() {} - private static final EnumSet DEFAULT_FLAGS_SET = EnumSet.allOf(Flag.class); - private static final int DEFAULT_FLAGS_SIZE = DEFAULT_FLAGS_SET.size(); - static final byte DEFAULT_FLAGS = toByte0(DEFAULT_FLAGS_SET); + private static final EnumSet ALL_FLAGS_SET = EnumSet.allOf(Flag.class); + private static final int ALL_FLAGS_SIZE = ALL_FLAGS_SET.size(); + static final byte ALL_FLAGS = toByte0(ALL_FLAGS_SET); /* bitwise utility methods */ @@ -45,8 +45,8 @@ final class FlagUtils { static byte toByte(Set settings) { // fast path for the default set of flags. - if (settings.size() == DEFAULT_FLAGS_SIZE) { - return DEFAULT_FLAGS; + if (settings.size() == ALL_FLAGS_SIZE) { + return ALL_FLAGS; } return toByte0(settings); } diff --git a/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsBuilderImpl.java b/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsBuilderImpl.java index 8734b44a0..539a97432 100644 --- a/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsBuilderImpl.java +++ b/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsBuilderImpl.java @@ -54,7 +54,7 @@ public class QueryOptionsBuilderImpl implements QueryOptions.Builder { public QueryOptionsBuilderImpl(QueryMode mode) { this.mode = mode; this.context = mode == QueryMode.CONTEXTUAL ? ImmutableContextSetImpl.EMPTY : null; - this.flags = FlagUtils.DEFAULT_FLAGS; + this.flags = FlagUtils.ALL_FLAGS; this.flagsSet = null; this.options = null; this.copyOptions = false; @@ -150,13 +150,13 @@ public class QueryOptionsBuilderImpl implements QueryOptions.Builder { if (this.options == null) { if (this.mode == QueryMode.NON_CONTEXTUAL) { - if (FlagUtils.DEFAULT_FLAGS == flags) { + if (FlagUtils.ALL_FLAGS == flags) { // mode same, contexts null, flags same, options null // so therefore, equal to default - return that instead! return QueryOptionsImpl.DEFAULT_NON_CONTEXTUAL; } } else if (this.mode == QueryMode.CONTEXTUAL) { - if (FlagUtils.DEFAULT_FLAGS == flags && this.context.isEmpty()) { + if (FlagUtils.ALL_FLAGS == flags && this.context.isEmpty()) { // mode same, contexts empty, flags same, options null // so therefore, equal to default - return that instead! return QueryOptionsImpl.DEFAULT_CONTEXTUAL; diff --git a/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java b/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java index 46f3ef6aa..20fd64f25 100644 --- a/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java +++ b/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java @@ -47,8 +47,8 @@ import java.util.Optional; import java.util.Set; public class QueryOptionsImpl implements QueryOptions { - public static final QueryOptions DEFAULT_CONTEXTUAL = new QueryOptionsImpl(QueryMode.CONTEXTUAL, ImmutableContextSetImpl.EMPTY, FlagUtils.DEFAULT_FLAGS, null); - public static final QueryOptions DEFAULT_NON_CONTEXTUAL = new QueryOptionsImpl(QueryMode.NON_CONTEXTUAL, null, FlagUtils.DEFAULT_FLAGS, null); + public static final QueryOptions DEFAULT_CONTEXTUAL = new QueryOptionsImpl(QueryMode.CONTEXTUAL, ImmutableContextSetImpl.EMPTY, FlagUtils.ALL_FLAGS, null); + public static final QueryOptions DEFAULT_NON_CONTEXTUAL = new QueryOptionsImpl(QueryMode.NON_CONTEXTUAL, null, FlagUtils.ALL_FLAGS, null); // state private final QueryMode mode;