diff --git a/README.md b/README.md index 1e2a4561..3a8f4ea7 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,13 @@ Note that you may optionally skip the slash and just write Installing ---------- -1. Download the latest release: [https://github.com/oloflarsson/Factions/tree/master/releases](https://github.com/oloflarsson/Factions/tree/master/releases)
+1. Download the latest release: [https://github.com/oloflarsson/Factions/tree/master/releases](https://github.com/oloflarsson/Factions/tree/master/releases)
1. Put Factions.jar in the plugins folder. A default config file will be created on the first run. License ---------- -This project has a LGPL license just like the Bukkit project. +This project has a LGPL license just like the Bukkit project.
This project uses [GSON](http://code.google.com/p/google-gson/) which has a [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0 ). diff --git a/plugin.yml b/plugin.yml index a8b543eb..accbb234 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,3 +1,3 @@ name: Factions -version: 1.0 beta5 +version: 1.0 beta6 main: com.bukkit.mcteam.factions.Factions \ No newline at end of file diff --git a/releases/factions 1.0beta6.zip b/releases/factions 1.0beta6.zip new file mode 100644 index 00000000..55bcbf1c Binary files /dev/null and b/releases/factions 1.0beta6.zip differ diff --git a/src/com/bukkit/mcteam/factions/entities/Board.java b/src/com/bukkit/mcteam/factions/entities/Board.java index 708d7150..29fa2878 100644 --- a/src/com/bukkit/mcteam/factions/entities/Board.java +++ b/src/com/bukkit/mcteam/factions/entities/Board.java @@ -13,7 +13,7 @@ import com.bukkit.mcteam.util.AsciiCompass; //import com.bukkit.mcteam.factions.util.*; public class Board { - public transient Long id; + public transient String worldName; protected Map coordFactionIds; public Board() { @@ -72,7 +72,7 @@ public class Board { public static void cleanAll() { for (Board board : getAll()) { - Log.debug("Cleaning board: "+board.id); + Log.debug("Cleaning board for world "+board.worldName); board.clean(); } } @@ -187,7 +187,7 @@ public class Board { //----------------------------------------------// public boolean save() { - return EM.boardSave(this.id); + return EM.boardSave(this.worldName); } public static Board get(World world) { diff --git a/src/com/bukkit/mcteam/factions/entities/EM.java b/src/com/bukkit/mcteam/factions/entities/EM.java index 404073c8..28849174 100644 --- a/src/com/bukkit/mcteam/factions/entities/EM.java +++ b/src/com/bukkit/mcteam/factions/entities/EM.java @@ -20,7 +20,7 @@ import com.bukkit.mcteam.gson.*; public class EM { protected static Map followers = new HashMap(); // Where String is a lowercase playername protected static Map factions = new HashMap(); // Where Integer is a primary auto increment key - protected static Map boards = new HashMap(); // Where Long is the semi (sadly) unique world id. + protected static Map boards = new HashMap(); // Where Long is the semi (sadly) unique world id. protected static int nextFactionId; // hardcoded config @@ -139,8 +139,8 @@ public class EM { name = name.substring(0, name.length() - ext.length()); try { Board board = gson.fromJson(DiscUtil.read(jsonFile), Board.class); - board.id = Long.parseLong(name); - boards.put(board.id, board); + board.worldName = name; + boards.put(board.worldName, board); Log.debug("loaded board "+name); } catch (Exception e) { e.printStackTrace(); @@ -158,37 +158,37 @@ public class EM { * A new Board will be created if the world did not have one */ public static Board boardGet(World world) { - if (boards.containsKey(world.getId())) { - return boards.get(world.getId()); + if (boards.containsKey(world.getName())) { + return boards.get(world.getName()); } return boardCreate(world); } - public static boolean boardSave(long id) { - Object obj = boards.get(id); + public static boolean boardSave(String worldName) { + Object obj = boards.get(worldName); if (obj == null) { - Log.warn("Could not save board "+id+" as it was not loaded"); + Log.warn("Could not save board "+worldName+" as it was not loaded"); return false; } folderBoard.mkdirs(); - File file = new File(folderBoard, id+ext); + File file = new File(folderBoard, worldName+ext); try { DiscUtil.write(file, gson.toJson(obj)); - Log.debug("Saved the board "+id); + Log.debug("Saved the board "+worldName); return true; } catch (IOException e) { e.printStackTrace(); - Log.warn("Failed to save the board "+id); + Log.warn("Failed to save the board "+worldName); return false; } } protected static Board boardCreate(World world) { - Log.debug("Creating new board "+world.getId()); + Log.debug("Creating new board for "+world.getName()); Board board = new Board(); - board.id = world.getId(); - boards.put(board.id, board); + board.worldName = world.getName(); + boards.put(board.worldName, board); board.save(); return board; }