1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Corruption Fix

This commit is contained in:
mrCookieSlime 2016-06-05 18:52:44 +02:00
parent 3f6c3afe9d
commit cca1c29c70

View File

@ -62,7 +62,8 @@ public class ChargableBlock {
}
public static int getDefaultCapacity(Location l) {
return max_charges.get(BlockStorage.checkID(l));
String id = BlockStorage.checkID(l);
return id == null ? 0: max_charges.get(id);
}
public static int getCharge(Block b) {
@ -173,6 +174,10 @@ public class ChargableBlock {
public static int getMaxCharge(Location l) {
Config cfg = BlockStorage.getBlockInfo(l);
if (!cfg.contains("id")) {
BlockStorage.clearBlockInfo(l);
return 0;
}
if (cfg.contains("energy-capacity")) return Integer.parseInt(cfg.getString("energy-capacity"));
else {
BlockStorage.addBlockInfo(l, "energy-capacity", String.valueOf(getDefaultCapacity(l)), false);