fix: don't quash a cancellation FaweException in LimitExtent (#2068)

- This allowed some edits to continue after a player left the server when they shouldn't
 - Possible sort-of fix for #1985
 - Possible fix for #1955
This commit is contained in:
Jordan 2023-01-15 23:33:44 +00:00 committed by GitHub
parent 98c2d2124e
commit ae57ac5d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getEntities(region); return super.getEntities(region);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return Collections.emptyList(); return Collections.emptyList();
@ -68,7 +68,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getEntities(); return super.getEntities();
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return Collections.emptyList(); return Collections.emptyList();
@ -83,7 +83,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.createEntity(location, entity); return super.createEntity(location, entity);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return null; return null;
@ -98,7 +98,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.createEntity(location, entity, uuid); return super.createEntity(location, entity, uuid);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return null; return null;
@ -112,7 +112,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
super.removeEntity(x, y, z, uuid); super.removeEntity(x, y, z, uuid);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
} }
@ -124,7 +124,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.regenerateChunk(x, z, type, seed); return super.regenerateChunk(x, z, type, seed);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return false; return false;
@ -137,7 +137,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getHighestTerrainBlock(x, z, minY, maxY); return super.getHighestTerrainBlock(x, z, minY, maxY);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -150,7 +150,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getHighestTerrainBlock(x, z, minY, maxY, filter); return super.getHighestTerrainBlock(x, z, minY, maxY, filter);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -163,7 +163,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getNearestSurfaceLayer(x, z, y, minY, maxY); return super.getNearestSurfaceLayer(x, z, y, minY, maxY);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -176,7 +176,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir); return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -189,7 +189,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY); return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -202,7 +202,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax); return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -215,7 +215,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask); return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -237,7 +237,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir); return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return minY; return minY;
@ -386,7 +386,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
filter.applyBlock(block.init(pos)); filter.applyBlock(block.init(pos));
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
} }
@ -404,7 +404,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getBlock(position); return super.getBlock(position);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return BlockTypes.AIR.getDefaultState(); return BlockTypes.AIR.getDefaultState();
@ -417,7 +417,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getBlock(x, y, z); return super.getBlock(x, y, z);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return BlockTypes.AIR.getDefaultState(); return BlockTypes.AIR.getDefaultState();
@ -430,7 +430,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getFullBlock(position); return super.getFullBlock(position);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return BlockTypes.AIR.getDefaultState().toBaseBlock(); return BlockTypes.AIR.getDefaultState().toBaseBlock();
@ -443,7 +443,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getFullBlock(x, y, z); return super.getFullBlock(x, y, z);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return BlockTypes.AIR.getDefaultState().toBaseBlock(); return BlockTypes.AIR.getDefaultState().toBaseBlock();
@ -456,7 +456,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getBiome(position); return super.getBiome(position);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return BiomeTypes.FOREST; return BiomeTypes.FOREST;
@ -469,7 +469,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.getBiomeType(x, y, z); return super.getBiomeType(x, y, z);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return BiomeTypes.FOREST; return BiomeTypes.FOREST;
@ -486,7 +486,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.setBlock(position, block); return super.setBlock(position, block);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return false; return false;
@ -502,7 +502,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.setBlock(x, y, z, block); return super.setBlock(x, y, z, block);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return false; return false;
@ -516,7 +516,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.setTile(x, y, z, tile); return super.setTile(x, y, z, tile);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return false; return false;
@ -529,7 +529,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.setBiome(position, biome); return super.setBiome(position, biome);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return false; return false;
@ -542,7 +542,7 @@ public class LimitExtent extends AbstractDelegateExtent {
try { try {
return super.setBiome(x, y, z, biome); return super.setBiome(x, y, z, biome);
} catch (FaweException e) { } catch (FaweException e) {
if (!limit.MAX_FAILS()) { if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) {
throw e; throw e;
} }
return false; return false;