diff --git a/src/main/java/net/minestom/server/tag/Tag.java b/src/main/java/net/minestom/server/tag/Tag.java index 9ef0bc584..d1f546709 100644 --- a/src/main/java/net/minestom/server/tag/Tag.java +++ b/src/main/java/net/minestom/server/tag/Tag.java @@ -21,8 +21,7 @@ public final class Tag { private final String key; private final Function readFunction; private final BiConsumer writeConsumer; - - protected volatile Supplier defaultValue; + private volatile Supplier defaultValue; private Tag(@NotNull String key, @NotNull Function readFunction, @@ -46,15 +45,12 @@ public final class Tag { return this; } - public @Nullable Supplier<@Nullable T> getDefaultValue() { - return defaultValue; - } - public @Nullable T read(@NotNull NBTCompound nbtCompound) { if (nbtCompound.containsKey(key)) { return readFunction.apply(nbtCompound); } else { - return defaultValue != null ? defaultValue.get() : null; + final var supplier = defaultValue; + return supplier != null ? supplier.get() : null; } }