mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Improve the handling of non-registered worlds
This commit is contained in:
parent
655fb44021
commit
c175596536
@ -391,21 +391,15 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
}
|
||||
});
|
||||
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
// Save all registered Worlds
|
||||
getRegistry().getWorlds().forEach((world, storage) -> {
|
||||
try {
|
||||
BlockStorage storage = BlockStorage.getStorage(world);
|
||||
|
||||
if (storage != null) {
|
||||
storage.save(true);
|
||||
}
|
||||
else {
|
||||
getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"{0}\"", world.getName());
|
||||
}
|
||||
storage.save(true);
|
||||
}
|
||||
catch (Exception x) {
|
||||
getLogger().log(Level.SEVERE, x, () -> "An Error occured while saving Slimefun-Blocks in World '" + world.getName() + "' for Slimefun " + getVersion());
|
||||
getLogger().log(Level.SEVERE, x, () -> "An Error occured while saving Slimefun-Blocks in World '" + world + "' for Slimefun " + getVersion());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (UniversalBlockMenu menu : registry.getUniversalInventories().values()) {
|
||||
menu.save();
|
||||
|
@ -480,6 +480,10 @@ public class BlockStorage {
|
||||
|
||||
public static void setBlockInfo(Location l, Config cfg, boolean updateTicker) {
|
||||
BlockStorage storage = getStorage(l.getWorld());
|
||||
if (storage == null) {
|
||||
Slimefun.getLogger().warning("Could not set Block info for non-registered World '" + l.getWorld().getName() + "'. Is some plugin trying to store data in a fake world?");
|
||||
return;
|
||||
}
|
||||
storage.storage.put(l, cfg);
|
||||
|
||||
String id = cfg.getString("id");
|
||||
|
Loading…
Reference in New Issue
Block a user