shift some code to EditSessionBuilder

This commit is contained in:
Jesse Boyd
2019-05-13 00:21:01 +10:00
parent c797dcb194
commit 43a6541763
7 changed files with 200 additions and 358 deletions

View File

@ -56,17 +56,6 @@ public abstract class FaweRegionExtent extends ResettableExtent {
return contains(p.getBlockX(), p.getBlockZ());
}
@Override
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
if (!contains(location)) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
}
return false;
}
return super.setBlock(location, block);
}
@Override
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
if (!contains(x, y, z)) {
@ -78,17 +67,6 @@ public abstract class FaweRegionExtent extends ResettableExtent {
return super.setBlock(x, y, z, block);
}
@Override
public boolean setBiome(BlockVector2 position, BiomeType biome) {
if (!contains(position)) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
}
return false;
}
return super.setBiome(position, biome);
}
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {
if (!contains(x, y, z)) {
@ -110,7 +88,18 @@ public abstract class FaweRegionExtent extends ResettableExtent {
}
return super.getBiome(position);
}
@Override
public BiomeType getBiome(int x, int z) {
if (!contains(x, z)) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
}
return null;
}
return super.getBiome(x, z);
}
@Override
public BaseBlock getFullBlock(BlockVector3 position) {
if (!contains(position)) {
@ -133,28 +122,6 @@ public abstract class FaweRegionExtent extends ResettableExtent {
return super.getBlock(position);
}
@Override
public BlockState getLazyBlock(BlockVector3 position) {
if (!contains(position)) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
}
return EditSession.nullBlock;
}
return super.getLazyBlock(position);
}
@Override
public BlockState getLazyBlock(int x, int y, int z) {
if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
}
return EditSession.nullBlock;
}
return super.getLazyBlock(x, y, z);
}
@Override
public int getBlockLight(int x, int y, int z) {
if (!contains(x, y, z)) {