1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Do not load incomplete blocks (missing "id")

If incomplete blocks are loaded, without an "id", items will not have
any usable slimefun block information and will not be usable. Breaking
these blocks will give you a "CSCoreLib's Head".
This commit is contained in:
Bas Verhoeven 2019-04-07 02:39:09 +02:00
parent 530189ecac
commit 1d7c1e68c8

View File

@ -98,7 +98,7 @@ public class BlockStorage {
System.out.println("[Slimefun] Loading Blocks... " + Math.round((((done * 100.0f) / total) * 100.0f) / 100.0f) + "% done (\"" + w.getName() + "\")");
timestamp = System.currentTimeMillis();
}
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
for (String key: cfg.getKeys(false)) {
Location l = deserializeLocation(key);
@ -107,9 +107,9 @@ public class BlockStorage {
totalBlocks++;
String json = cfg.getString(key);
Config blockInfo = parseBlockInfo(l, json);
if (blockInfo == null) continue;
if (blockInfo == null || !blockInfo.contains("id")) continue;
storage.put(l, blockInfo);
if (SlimefunItem.isTicking(file.getName().replace(".sfb", ""))) {
Set<Location> locations = ticking_chunks.containsKey(chunk_string) ? ticking_chunks.get(chunk_string): new HashSet<Location>();
locations.add(l);