From 99669d4d7c8e29f2899c0eb49c952eed2fcc8d43 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 21 Feb 2020 16:05:44 +0100 Subject: [PATCH] Adding debug output for failing materials, changing to vanilla WE support Signed-off-by: Lixfel --- SchematicSystem_14/pom.xml | 4 ++-- .../de/steamwar/schematicsystem/WorldEdit_14.java | 9 ++------- SchematicSystem_15/pom.xml | 4 ++-- .../schematicsystem/CheckSchemType_15.java | 14 +++++++------- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/SchematicSystem_14/pom.xml b/SchematicSystem_14/pom.xml index 98a4957..371b1cc 100644 --- a/SchematicSystem_14/pom.xml +++ b/SchematicSystem_14/pom.xml @@ -40,8 +40,8 @@ steamwar - FAWE - 1.14 + WorldEdit + 1.15 provided diff --git a/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java b/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java index 6d3336b..beecc4e 100644 --- a/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java +++ b/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java @@ -1,7 +1,6 @@ package de.steamwar.schematicsystem; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.extent.clipboard.Clipboard; @@ -28,12 +27,8 @@ class WorldEdit_14 { BlockVector3 dimensions = clipboard.getDimensions(); BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset); EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1); - try { - Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build()); - } catch (MaxChangedBlocksException ex) { - throw new IOException(ex); - } - e.flushQueue(); + Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build()); + e.flushSession(); return e; } } diff --git a/SchematicSystem_15/pom.xml b/SchematicSystem_15/pom.xml index 365f874..0969ed3 100644 --- a/SchematicSystem_15/pom.xml +++ b/SchematicSystem_15/pom.xml @@ -45,8 +45,8 @@ steamwar - FAWE - 1.14 + WorldEdit + 1.15 provided diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java index d92596f..3f89708 100644 --- a/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java +++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java @@ -99,6 +99,10 @@ class CheckSchemType_15 { for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++){ final BaseBlock block = clipboard.getFullBlock(BlockVector3.at(x, y, z)); final Material blockMaterial = Material.matchMaterial(block.getBlockType().getId()); + if(blockMaterial == null) + throw new SecurityException("Unknown material, please resolve " + block.getBlockType().getName() + " " + block.getBlockType().getId()); + + result.checkMaterial(blockMaterial.name()); if(blockMaterial == Material.TNT || blockMaterial == Material.OBSIDIAN) tnt++; @@ -109,12 +113,8 @@ class CheckSchemType_15 { if(blockMaterial == Material.DISPENSER) dispenser++; - if(INVENTORY.contains(blockMaterial)){ - checkInventory(result, block, blockMaterial, type); - } - - assert blockMaterial != null; - result.checkMaterial(blockMaterial.name()); + if(INVENTORY.contains(blockMaterial)) + checkInventory(result, block, blockMaterial); } } } @@ -126,7 +126,7 @@ class CheckSchemType_15 { return result; } - private static void checkInventory(AutoCheckResult result, BaseBlock block, Material blockMaterial, ICheckSchemType type){ + private static void checkInventory(AutoCheckResult result, BaseBlock block, Material blockMaterial){ CompoundTag nbt = block.getNbtData(); if(nbt == null){ result.defunctNbt(blockMaterial.name());