add fallback to old id-based system for chunk snapshots

This commit is contained in:
RoboMWM 2017-12-23 08:28:12 -08:00
parent fd0ddbf405
commit 9c5c7523a2

View File

@ -71,8 +71,34 @@ class AutoExtendClaimTask implements Runnable
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;
for(ChunkSnapshot chunk : this.chunks)
{
Biome biome = chunk.getBiome(0, 0);
ArrayList<Material> playerBlockIDs = RestoreNatureProcessingTask.getPlayerBlocks(this.worldType, biome);
boolean ychanged = true;
while(!this.yTooSmall(y) && ychanged)
{
ychanged = false;
for(int x = 0; x < 16; x++)
{
for(int z = 0; z < 16; z++)
{
int blockType = chunk.getBlockTypeId(x, y, z);
while(!this.yTooSmall(y) && playerBlockIDs.contains(Material.getMaterial(blockType)))
{
ychanged = true;
blockType = chunk.getBlockTypeId(x, --y, z);
}
if(this.yTooSmall(y)) return y;
}
}
}
if(this.yTooSmall(y)) return y;
}
}