Use internal yaml resource for unsafe blocks by key, remove caching, fixes

This commit is contained in:
William committed 2022-11-23 21:51:23 +00:00
1 parent c4b16db9a9
commit a3ea62a85c
11 files changed
+215 -269

No files matched your search

@@ -0,0 +1,36 @@
package net.william278.huskhomes.util;
import net.william278.annotaml.YamlFile;
import net.william278.annotaml.YamlKey;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@YamlFile(header = """
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Unsafe /rtp Blocks ┃
┃ Developed by William278 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛""")
public class UnsafeBlocks {
@YamlKey("unsafe_blocks")
public List<String> unsafeBlocks;
/**
* Returns if the block, by provided identifier, is unsafe
*
* @param blockId The block identifier (e.g. {@code minecraft:stone})
* @return {@code true} if the block is on the unsafe blocks list, {@code false} otherwise
*/
public boolean isUnsafe(@NotNull String blockId) {
if (!blockId.startsWith("minecraft:")) {
blockId = "minecraft:" + blockId;
}
return unsafeBlocks.contains(blockId);
}
@SuppressWarnings("unused")
public UnsafeBlocks() {
}
}