1
0
mirror of https://github.com/BentoBoxWorld/Warps.git synced 2024-11-25 20:16:11 +01:00

Check for warp file before loading

This commit is contained in:
tastybento 2019-01-29 14:04:56 -08:00
parent 2bf5299a16
commit da996714a1

View File

@ -163,15 +163,18 @@ public class WarpSignsManager {
private void loadWarpList() {
addon.getLogger().info("Loading warps...");
worldsWarpList = new HashMap<>();
WarpsData warps = handler.loadObject("warps");
// Load into map
if (warps != null) {
warps.getWarpSigns().forEach((k,v) -> {
if (k != null && (k.getBlock().getType().equals(Material.SIGN) || k.getBlock().getType().equals(Material.WALL_SIGN))) {
// Add to map
getWarpMap(k.getWorld()).put(v, k);
}
});
WarpsData warps = new WarpsData();
if (handler.objectExists("warps")) {
warps = handler.loadObject("warps");
// Load into map
if (warps != null) {
warps.getWarpSigns().forEach((k,v) -> {
if (k != null && (k.getBlock().getType().equals(Material.SIGN) || k.getBlock().getType().equals(Material.WALL_SIGN))) {
// Add to map
getWarpMap(k.getWorld()).put(v, k);
}
});
}
}
}