Merge pull request #3309 from miiichael/patch-1

Resize stateByID by 10% instead of a single element at a time
This commit is contained in:
mikeprimm 2021-03-11 20:38:21 -06:00 committed by GitHub
commit aef7a16b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,7 +239,8 @@ public class DynmapPlugin
int idx = bsids.getId(bs); int idx = bsids.getId(bs);
if (idx >= stateByID.length) { if (idx >= stateByID.length) {
int plen = stateByID.length; int plen = stateByID.length;
stateByID = Arrays.copyOf(stateByID, idx+1); stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10%
Log.debug("Resized stateByID from " + plen + " to " + stateByID.length);
Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR); Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR);
} }
Block b = bs.getBlock(); Block b = bs.getBlock();