Fix crash issues

This commit is contained in:
Daniel Mills 2020-10-12 19:59:24 -04:00
parent e72ea21b6b
commit ac2dcee6c3
3 changed files with 20 additions and 7 deletions

View File

@ -48,7 +48,12 @@ public class AtomicSliver
public Material getType(int h) public Material getType(int h)
{ {
return get(h).getMaterial(); return getTypeSafe(h);
}
public Material getTypeSafe(int h)
{
return get(h > 255 ? 255 : h < 0 ? 0 : h).getMaterial();
} }
public KList<Byte> getUpdatables() public KList<Byte> getUpdatables()

View File

@ -164,11 +164,11 @@ public class GenLayerCave extends GenLayer
public boolean dig(int x, int y, int z, AtomicSliver data, Function<Integer, BlockData> caveFluid) public boolean dig(int x, int y, int z, AtomicSliver data, Function<Integer, BlockData> caveFluid)
{ {
Material a = data.getType(y); Material a = data.getTypeSafe(y);
Material c = data.getType(y + 1); Material c = data.getTypeSafe(y + 1);
Material d = data.getType(y + 2); Material d = data.getTypeSafe(y + 2);
Material e = data.getType(y + 3); Material e = data.getTypeSafe(y + 3);
Material f = data.getType(y - 1); Material f = data.getTypeSafe(y - 1);
BlockData b = caveFluid.apply(y); BlockData b = caveFluid.apply(y);
BlockData b2 = caveFluid.apply(y + 1); BlockData b2 = caveFluid.apply(y + 1);

View File

@ -87,7 +87,15 @@ public class EditManager implements Listener
if(Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) if(Bukkit.getPluginManager().isPluginEnabled("WorldEdit"))
{ {
e = new WEBlockEditor(world); try
{
e = new WEBlockEditor(world);
}
catch(Throwable ex)
{
e = new BukkitBlockEditor(world);
}
} }
else else