Changes config version number, adds a file check for schematics

This commit is contained in:
Thijs Wiefferink 2015-01-06 22:35:08 +01:00
parent ea31dfdd65
commit e6c5653073
2 changed files with 6 additions and 4 deletions

View File

@ -40,7 +40,7 @@ postCommandErrors: true
## Enables / disables debug messages in the console, could be useful to figure out where errors come from ## Enables / disables debug messages in the console, could be useful to figure out where errors come from
debug: false debug: false
## Version of the config, do not change! ## Version of the config, do not change!
version: 2.1.1 version: 2.1.2
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ # ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐

View File

@ -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;
import com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException; import com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException;
@SuppressWarnings("deprecation")
public abstract class GeneralRegion { public abstract class GeneralRegion {
protected YamlConfiguration config; protected YamlConfiguration config;
private static ArrayList<Material> canSpawnIn = new ArrayList<Material>(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)); private static ArrayList<Material> canSpawnIn = new ArrayList<Material>(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) { public boolean restoreRegionBlocks(String fileName) {
boolean result = true; boolean result = true;
// TODO: test world cast
EditSession editSession = plugin.getWorldEdit().getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(getWorld()), plugin.getConfig().getInt("maximumBlocks")); EditSession editSession = plugin.getWorldEdit().getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(getWorld()), plugin.getConfig().getInt("maximumBlocks"));
ProtectedRegion region = plugin.getWorldGuard().getRegionManager(getWorld()).getRegion(getName()); ProtectedRegion region = plugin.getWorldGuard().getRegionManager(getWorld()).getRegion(getName());
if(region == null) { if(region == null) {
@ -854,7 +852,10 @@ public abstract class GeneralRegion {
// The path to save the schematic // The path to save the schematic
File restoreFile = new File(plugin.getFileManager().getSchematicFolder() + File.separator + fileName + AreaShop.schematicExtension); 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 // // NEW
// Closer closer = Closer.create(); // Closer closer = Closer.create();
// try { // try {
@ -894,6 +895,7 @@ public abstract class GeneralRegion {
plugin.getLogger().warning("Exeeded the block limit while restoring schematic of " + getName()); plugin.getLogger().warning("Exeeded the block limit while restoring schematic of " + getName());
result = false; result = false;
} catch(IOException | DataException e) { } catch(IOException | DataException e) {
AreaShop.debug(e.getMessage());
result = false; result = false;
} }
editSession.flushQueue(); editSession.flushQueue();