From 13dbf6e8f1d44cb51adf3a893fd865d9ab62c769 Mon Sep 17 00:00:00 2001 From: Drakia Date: Sat, 12 Feb 2011 20:30:52 -0800 Subject: [PATCH] Fixed where the default gate is saved to. --- README | 2 ++ src/net/TheDgtl/Stargate/Gate.java | 12 ++++++------ src/plugin.yml | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README b/README index c70e219..a7f21d2 100644 --- a/README +++ b/README @@ -73,6 +73,8 @@ Configuration ============= Changes ============= +[Version 0.07] + - Fixed where the default gate is saved to. [Version 0.06] - Forgot to make gates load from new location, oops [Version 0.05] diff --git a/src/net/TheDgtl/Stargate/Gate.java b/src/net/TheDgtl/Stargate/Gate.java index b14a6b3..4bb25d9 100644 --- a/src/net/TheDgtl/Stargate/Gate.java +++ b/src/net/TheDgtl/Stargate/Gate.java @@ -87,11 +87,11 @@ public class Gate { this.controls = controlList.toArray(this.controls); } - public void save() { + public void save(String gateFolder) { HashMap reverse = new HashMap(); try { - BufferedWriter bw = new BufferedWriter(new FileWriter("stargates/" + filename)); + BufferedWriter bw = new BufferedWriter(new FileWriter(gateFolder + filename)); writeConfig(bw, "portal-open", portalBlockOpen); writeConfig(bw, "portal-closed", portalBlockClosed); @@ -313,7 +313,7 @@ public class Gate { Stargate.log.log(Level.SEVERE, "Could not load Gate " + file.getName() + " - Gates must have exactly 2 control points."); return null; } else { - gate.save(); // Updates format for version changes + gate.save(file.getParent() + File.separator); // Updates format for version changes return gate; } } @@ -342,7 +342,7 @@ public class Gate { if (files.length == 0) { dir.mkdir(); - populateDefaults(dir); + populateDefaults(gateFolder); } else { for (File file : files) { Gate gate = loadGate(file); @@ -351,7 +351,7 @@ public class Gate { } } - public static void populateDefaults(File dir) { + public static void populateDefaults(String gateFolder) { Integer[][] layout = new Integer[][] { {ANYTHING, Portal.OBSIDIAN, Portal.OBSIDIAN, ANYTHING}, {Portal.OBSIDIAN, ENTRANCE, ENTRANCE, Portal.OBSIDIAN}, @@ -364,7 +364,7 @@ public class Gate { types.put('-', Portal.OBSIDIAN); Gate gate = new Gate("nethergate.gate", layout, types); - gate.save(); + gate.save(gateFolder); registerGate(gate); } diff --git a/src/plugin.yml b/src/plugin.yml index 465353a..e14a346 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Stargate main: net.TheDgtl.Stargate.Stargate -version: 0.06 +version: 0.07 description: Stargate mod for Bukkit author: Drakia website: http://www.thedgtl.net \ No newline at end of file