1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-03 07:54:07 +01:00

Fix issue when the world is not exists and throws errors

This commit is contained in:
montlikadani 2020-03-08 14:12:29 +01:00
parent 4f39da6db4
commit d5c942363e
2 changed files with 10 additions and 4 deletions

View File

@ -350,15 +350,16 @@ public class FurnaceBrewingHandling {
List<blockLoc> ls = brewingMap.remove(uuid); List<blockLoc> ls = brewingMap.remove(uuid);
if (ls == null) if (ls == null)
return 0; return 0;
for (blockLoc one : ls) { for (blockLoc one : ls) {
Block block = one.getBlock(); Block block = one.getBlock();
if (block == null) if (block == null)
continue; continue;
if (!CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND)) if (CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND))
continue; block.removeMetadata(JobsPaymentListener.brewingOwnerMetadata, Jobs.getInstance());
block.removeMetadata(JobsPaymentListener.brewingOwnerMetadata, Jobs.getInstance());
} }
return ls.size(); return ls.size();
} }

View File

@ -84,10 +84,15 @@ public class blockLoc {
World w = this.w == null ? Bukkit.getWorld(worldName) : this.w; World w = this.w == null ? Bukkit.getWorld(worldName) : this.w;
if (w == null) if (w == null)
return null; return null;
w = Bukkit.getWorld(w.getName());
if (w == null) {
return null;
}
this.w = w; this.w = w;
Location loc = new Location(w, x, y, z); Location loc = new Location(w, x, y, z);
return loc; return loc;
} }
} }