clean up ProcessedWEExtent

This commit is contained in:
Alexander Söderberg 2020-05-13 12:47:52 +02:00
parent 435d877262
commit e6878d7804
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678

View File

@ -89,55 +89,19 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
@Override @Override
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block)
throws WorldEditException { throws WorldEditException {
String id = block.getBlockType().getId();
switch (id) { final boolean isTile = block.toBaseBlock().getNbtData() != null;
case "54": if (isTile) {
case "130":
case "142":
case "27":
case "137":
case "52":
case "154":
case "84":
case "25":
case "144":
case "138":
case "176":
case "177":
case "63":
case "68":
case "323":
case "117":
case "116":
case "28":
case "66":
case "157":
case "61":
case "62":
case "140":
case "146":
case "149":
case "150":
case "158":
case "23":
case "123":
case "124":
case "29":
case "33":
case "151":
case "178":
if (this.BSblocked) { if (this.BSblocked) {
return false; return false;
} }
this.BScount++; if (++this.BScount > Settings.Chunk_Processor.MAX_TILES) {
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true; this.BSblocked = true;
PlotSquared.debug( PlotSquared.debug(Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getX() + ","
Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getX() + ","
+ location.getZ()); + location.getZ());
} }
if (WEManager }
.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) { if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
if (this.count++ > this.max) { if (this.count++ > this.max) {
if (this.parent != null) { if (this.parent != null) {
try { try {
@ -154,30 +118,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
} }
return super.setBlock(location, block); return super.setBlock(location, block);
} }
break;
default:
if (WEManager
.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
if (this.count++ > this.max) {
if (this.parent != null) {
try {
Field field =
AbstractDelegateExtent.class.getDeclaredField("extent");
field.setAccessible(true);
field.set(this.parent, new NullExtent());
} catch (Exception e) {
e.printStackTrace();
}
this.parent = null;
}
return false;
}
super.setBlock(location, block);
}
return true;
} return !isTile;
return false;
} }
@Override public Entity createEntity(Location location, BaseEntity entity) { @Override public Entity createEntity(Location location, BaseEntity entity) {