placedBy null support.

This commit is contained in:
Brianna 2019-10-14 09:41:57 -04:00
parent 22bd0a4e27
commit bfa4297cb4
2 changed files with 5 additions and 5 deletions

View File

@ -134,9 +134,9 @@ public class EpicFarming extends SongodaPlugin {
items = configItems;
}
UUID placedBY = null;
String configPlacedBY = row.get("placedby").asString();
if (configPlacedBY != null) {
placedBY = UUID.fromString(configPlacedBY);
String configPlacedBy = row.get("placedby").asString();
if (configPlacedBy != null) {
placedBY = UUID.fromString(configPlacedBy);
}
Farm farm = new Farm(location, levelManager.getLevel(level), placedBY);
farm.setItems(items);
@ -215,7 +215,7 @@ public class EpicFarming extends SongodaPlugin {
for (String levelName : levelsFile.getKeys(false)) {
ConfigurationSection levels = levelsFile.getConfigurationSection(levelName);
int level = Integer.valueOf(levelName.split("-")[1]);
int level = Integer.parseInt(levelName.split("-")[1]);
int costExperiance = levels.getInt("Cost-xp");
int costEconomy = levels.getInt("Cost-eco");
int radius = levels.getInt("Radius");

View File

@ -35,7 +35,7 @@ public abstract class Storage {
String locstr = Methods.serializeLocation(farm.getLocation());
prepareSaveItem("farms", new StorageItem("location", locstr),
new StorageItem("level", farm.getLevel().getLevel()),
new StorageItem("placedby", farm.getPlacedBy().toString()),
new StorageItem("placedby", farm.getPlacedBy() == null ? null : farm.getPlacedBy().toString()),
new StorageItem("contents", farm.getItems()));
}