PlotBlock cache / events / flags

This commit is contained in:
Jesse Boyd
2016-06-04 06:20:13 +10:00
parent f84766074e
commit ca5d3a818b
26 changed files with 171 additions and 138 deletions

View File

@ -1066,7 +1066,7 @@ public class BukkitChunkManager extends ChunkManager {
if (typeId == 0) {
ids[y] = PlotBlock.EVERYTHING;
} else {
ids[y] = new PlotBlock((short) typeId, block.getData());
ids[y] = PlotBlock.get((short) typeId, block.getData());
}
}
if (!id.equals(Material.AIR)) {

View File

@ -270,7 +270,7 @@ public class BukkitUtil extends WorldUtil {
public StringComparison<PlotBlock>.ComparisonResult getClosestBlock(String name) {
try {
Material material = Material.valueOf(name.toUpperCase());
return new StringComparison<PlotBlock>().new ComparisonResult(0, new PlotBlock((short) material.getId(), (byte) 0));
return new StringComparison<PlotBlock>().new ComparisonResult(0, PlotBlock.get((short) material.getId(), (byte) 0));
} catch (IllegalArgumentException ignored) {}
try {
byte data;
@ -291,7 +291,7 @@ public class BukkitUtil extends WorldUtil {
match = comparison.match;
id = (short) comparison.best.getId();
}
PlotBlock block = new PlotBlock(id, data);
PlotBlock block = PlotBlock.get(id, data);
StringComparison<PlotBlock> outer = new StringComparison<>();
return outer.new ComparisonResult(match, block);
@ -317,7 +317,7 @@ public class BukkitUtil extends WorldUtil {
if (block == null) {
return PlotBlock.EVERYTHING;
}
return new PlotBlock((short) block.getTypeId(), block.getData());
return PlotBlock.get((short) block.getTypeId(), block.getData());
}
@Override

View File

@ -35,7 +35,7 @@ public class SlowChunk extends PlotChunk<Chunk> {
if (this.result[y >> 4] == null) {
this.result[y >> 4] = new PlotBlock[4096];
}
this.result[MainUtil.CACHE_I[y][x][z]][MainUtil.CACHE_J[y][x][z]] = new PlotBlock((short) id, data);
this.result[MainUtil.CACHE_I[y][x][z]][MainUtil.CACHE_J[y][x][z]] = PlotBlock.get((short) id, data);
}
@Override