Skip to content

Commit

Permalink
Changes config version number, adds a file check for schematics
Browse files Browse the repository at this point in the history
  • Loading branch information
NLthijs48 committed Jan 6, 2015
1 parent ea31dfd commit e6c5653
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Expand Down
8 changes: 5 additions & 3 deletions src/nl/evolutioncoding/areashop/regions/GeneralRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
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<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));
Expand Down Expand Up @@ -841,7 +840,6 @@ public boolean saveRegionBlocks(String fileName) {
*/
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) {
Expand All @@ -854,7 +852,10 @@ public boolean restoreRegionBlocks(String fileName) {
// 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 {
Expand Down Expand Up @@ -894,6 +895,7 @@ public boolean restoreRegionBlocks(String fileName) {
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();
Expand Down

0 comments on commit e6c5653

Please sign in to comment.