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,95 +89,37 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
@Override
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block)
throws WorldEditException {
String id = block.getBlockType().getId();
switch (id) {
case "54":
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) {
return false;
}
this.BScount++;
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true;
PlotSquared.debug(
Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getX() + ","
+ location.getZ());
}
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;
}
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;
final boolean isTile = block.toBaseBlock().getNbtData() != null;
if (isTile) {
if (this.BSblocked) {
return false;
}
if (++this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true;
PlotSquared.debug(Captions.PREFIX + "&cDetected unsafe WorldEdit: " + location.getX() + ","
+ location.getZ());
}
}
return false;
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;
}
return super.setBlock(location, block);
}
return !isTile;
}
@Override public Entity createEntity(Location location, BaseEntity entity) {