handle case of server not having ChunkSnapshot#getBlockType

i.e. tell server owner to update and handle conservatively.
This commit is contained in:
RoboMWM 2017-12-20 09:57:12 -08:00
parent 2a68fb9795
commit fd0ddbf405

View File

@ -32,40 +32,49 @@ class AutoExtendClaimTask implements Runnable
}
}
@SuppressWarnings("deprecation")
private int getLowestBuiltY()
{
int y = this.claim.getLesserBoundaryCorner().getBlockY();
if(this.yTooSmall(y)) return y;
for(ChunkSnapshot chunk : this.chunks)
try
{
Biome biome = chunk.getBiome(0, 0);
ArrayList<Material> playerBlockIDs = RestoreNatureProcessingTask.getPlayerBlocks(this.worldType, biome);
boolean ychanged = true;
while(!this.yTooSmall(y) && ychanged)
for(ChunkSnapshot chunk : this.chunks)
{
ychanged = false;
for(int x = 0; x < 16; x++)
Biome biome = chunk.getBiome(0, 0);
ArrayList<Material> playerBlockIDs = RestoreNatureProcessingTask.getPlayerBlocks(this.worldType, biome);
boolean ychanged = true;
while(!this.yTooSmall(y) && ychanged)
{
for(int z = 0; z < 16; z++)
ychanged = false;
for(int x = 0; x < 16; x++)
{
Material blockType = chunk.getBlockType(x, y, z);
while(!this.yTooSmall(y) && playerBlockIDs.contains(blockType))
for(int z = 0; z < 16; z++)
{
ychanged = true;
blockType = chunk.getBlockType(x, --y, z);
Material blockType = chunk.getBlockType(x, y, z);
while(!this.yTooSmall(y) && playerBlockIDs.contains(blockType))
{
ychanged = true;
blockType = chunk.getBlockType(x, --y, z);
}
if(this.yTooSmall(y)) return y;
}
if(this.yTooSmall(y)) return y;
}
}
if(this.yTooSmall(y)) return y;
}
if(this.yTooSmall(y)) return y;
}
catch (NoSuchMethodError e)
{
GriefPrevention.instance.getLogger().severe("You are running an outdated build of Craftbukkit/Spigot/Paper. Please update.");
GriefPrevention.instance.AddLogEntry("Claim " + claim.getID() + " was auto-extended to maximum depth.", CustomLogEntryTypes.Debug, false);
return GriefPrevention.instance.config_claims_maxDepth;
}
return y;
}