mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 13:45:20 +01:00
Use reflection in the #getAllKeys method instead of a list
This commit is contained in:
parent
424af27a47
commit
ab9284b80f
@ -40,6 +40,8 @@ import me.lucko.luckperms.common.defaults.Rule;
|
|||||||
import me.lucko.luckperms.common.storage.DatastoreConfiguration;
|
import me.lucko.luckperms.common.storage.DatastoreConfiguration;
|
||||||
import me.lucko.luckperms.common.utils.ImmutableCollectors;
|
import me.lucko.luckperms.common.utils.ImmutableCollectors;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -145,44 +147,25 @@ public class ConfigKeys {
|
|||||||
public static final ConfigKey<String> REDIS_PASSWORD = EnduringKey.wrap(StringKey.of("redis.password", ""));
|
public static final ConfigKey<String> REDIS_PASSWORD = EnduringKey.wrap(StringKey.of("redis.password", ""));
|
||||||
|
|
||||||
public static List<ConfigKey<?>> getAllKeys() {
|
public static List<ConfigKey<?>> getAllKeys() {
|
||||||
return ImmutableList.<ConfigKey<?>>builder()
|
ImmutableList.Builder<ConfigKey<?>> keys = ImmutableList.builder();
|
||||||
.add(SERVER)
|
|
||||||
.add(SYNC_TIME)
|
try {
|
||||||
.add(DEFAULT_GROUP_NODE)
|
Field[] values = ConfigKeys.class.getFields();
|
||||||
.add(DEFAULT_GROUP_NAME)
|
for (Field f : values) {
|
||||||
.add(INCLUDING_GLOBAL_PERMS)
|
if (!Modifier.isStatic(f.getModifiers())) {
|
||||||
.add(INCLUDING_GLOBAL_WORLD_PERMS)
|
continue;
|
||||||
.add(APPLYING_GLOBAL_GROUPS)
|
}
|
||||||
.add(APPLYING_GLOBAL_WORLD_GROUPS)
|
|
||||||
.add(ONLINE_MODE)
|
Object val = f.get(null);
|
||||||
.add(APPLYING_WILDCARDS)
|
if (val instanceof ConfigKey<?>) {
|
||||||
.add(APPLYING_REGEX)
|
keys.add((ConfigKey<?>) val);
|
||||||
.add(APPLYING_SHORTHAND)
|
}
|
||||||
.add(GROUP_WEIGHTS)
|
}
|
||||||
.add(LOG_NOTIFY)
|
} catch (Exception e) {
|
||||||
.add(AUTO_OP)
|
e.printStackTrace();
|
||||||
.add(OPS_ENABLED)
|
}
|
||||||
.add(COMMANDS_ALLOW_OP)
|
|
||||||
.add(VAULT_SERVER)
|
return keys.build();
|
||||||
.add(VAULT_INCLUDING_GLOBAL)
|
|
||||||
.add(VAULT_IGNORE_WORLD)
|
|
||||||
.add(VAULT_PRIMARY_GROUP_OVERRIDES)
|
|
||||||
.add(VAULT_PRIMARY_GROUP_OVERRIDES_CHECK_INHERITED)
|
|
||||||
.add(VAULT_PRIMARY_GROUP_OVERRIDES_CHECK_EXISTS)
|
|
||||||
.add(VAULT_PRIMARY_GROUP_OVERRIDES_CHECK_MEMBER_OF)
|
|
||||||
.add(VAULT_DEBUG)
|
|
||||||
.add(WORLD_REWRITES)
|
|
||||||
.add(GROUP_NAME_REWRITES)
|
|
||||||
.add(DEFAULT_ASSIGNMENTS)
|
|
||||||
.add(DATABASE_VALUES)
|
|
||||||
.add(SQL_TABLE_PREFIX)
|
|
||||||
.add(STORAGE_METHOD)
|
|
||||||
.add(SPLIT_STORAGE)
|
|
||||||
.add(SPLIT_STORAGE_OPTIONS)
|
|
||||||
.add(REDIS_ENABLED)
|
|
||||||
.add(REDIS_ADDRESS)
|
|
||||||
.add(REDIS_PASSWORD)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user