From e6878d780436ba2f0d23a2ffab64e59678cdebf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Wed, 13 May 2020 12:47:52 +0200 Subject: [PATCH] clean up ProcessedWEExtent --- .../core/listener/ProcessedWEExtent.java | 116 +++++------------- 1 file changed, 29 insertions(+), 87 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java b/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java index a67e743c8..5e3f0af8e 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java @@ -89,95 +89,37 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { @Override public > 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) {