diff --git a/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java b/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java index f32e8411..1e65bec4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java @@ -28,22 +28,23 @@ import com.google.common.cache.LoadingCache; import me.lucko.luckperms.common.config.keys.EnduringKey; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @SuppressWarnings("unchecked") public abstract class AbstractConfiguration implements LPConfiguration { - private final LoadingCache, Object> cache = CacheBuilder.newBuilder() - .build(new CacheLoader, Object>() { + private final LoadingCache, Optional> cache = CacheBuilder.newBuilder() + .build(new CacheLoader, Optional>() { @Override - public Object load(ConfigKey key) { - return key.get(AbstractConfiguration.this); + public Optional load(ConfigKey key) { + return Optional.ofNullable(key.get(AbstractConfiguration.this)); } }); @Override public T get(ConfigKey key) { - return (T) cache.getUnchecked(key); + return (T) cache.getUnchecked(key).orElse(null); } @Override