From e6c5653073e00423f0d3f404c1d302c5a80b3ee9 Mon Sep 17 00:00:00 2001 From: Thijs Wiefferink Date: Tue, 6 Jan 2015 22:35:08 +0100 Subject: [PATCH] Changes config version number, adds a file check for schematics --- config.yml | 2 +- .../evolutioncoding/areashop/regions/GeneralRegion.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.yml b/config.yml index 54338e5..86efbbd 100644 --- a/config.yml +++ b/config.yml @@ -40,7 +40,7 @@ postCommandErrors: true ## Enables / disables debug messages in the console, could be useful to figure out where errors come from debug: false ## Version of the config, do not change! -version: 2.1.1 +version: 2.1.2 # ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ diff --git a/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java b/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java index 0d51ba6..556434d 100644 --- a/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java +++ b/src/nl/evolutioncoding/areashop/regions/GeneralRegion.java @@ -48,7 +48,6 @@ import com.sk89q.worldguard.protection.flags.RegionGroupFlag; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException; -@SuppressWarnings("deprecation") public abstract class GeneralRegion { protected YamlConfiguration config; private static ArrayList canSpawnIn = new ArrayList(Arrays.asList(Material.WOOD_DOOR, Material.WOODEN_DOOR, Material.SIGN_POST, Material.WALL_SIGN, Material.STONE_PLATE, Material.IRON_DOOR_BLOCK, Material.WOOD_PLATE, Material.TRAP_DOOR, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.DRAGON_EGG, Material.GOLD_PLATE, Material.IRON_PLATE)); @@ -841,7 +840,6 @@ public abstract class GeneralRegion { */ public boolean restoreRegionBlocks(String fileName) { boolean result = true; - // TODO: test world cast EditSession editSession = plugin.getWorldEdit().getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(getWorld()), plugin.getConfig().getInt("maximumBlocks")); ProtectedRegion region = plugin.getWorldGuard().getRegionManager(getWorld()).getRegion(getName()); if(region == null) { @@ -854,7 +852,10 @@ public abstract class GeneralRegion { // The path to save the schematic File restoreFile = new File(plugin.getFileManager().getSchematicFolder() + File.separator + fileName + AreaShop.schematicExtension); - + if(!restoreFile.exists() || !restoreFile.isFile()) { + plugin.getLogger().info("Did not restore region " + getName() + ", file does not exist: " + restoreFile); + return false; + } // // NEW // Closer closer = Closer.create(); // try { @@ -894,6 +895,7 @@ public abstract class GeneralRegion { plugin.getLogger().warning("Exeeded the block limit while restoring schematic of " + getName()); result = false; } catch(IOException | DataException e) { + AreaShop.debug(e.getMessage()); result = false; } editSession.flushQueue();