diff --git a/README b/README index 82e12a8..0ebc886 100644 --- a/README +++ b/README @@ -1,26 +1,31 @@ -Changes in 0.03 - - Changed package to net.TheDgtl.* - - Everything now uses Blox instead of Block objects - - Started on vehicle code, but it's still buggy - -Known Issues: +============= + Description +============= +This is a port of the Stargate plugin from hMod. +Create gates that allow for instant-teleportation between large distances. Gates can be always-open, or triggered, they can be hidden, or accessible to everybody, they can share a network, or they can be split into clusters. +This port will import your existing locations.dat file from the hMod Stargate plugin, as well as any custom .gate files you had! +All of the iConomy code was removed. + +This version of Stargate is still heavily under development. There are going to be issues for a while yet. + +============= +Known Issues +============= - Vehicle implementation is nowhere near done. - Signs aren't always updating, I don't know what's causing this, I think it's a Bukkit thing. + - You need to right-click the sign to initialize the gate, waiting on SIGN_CHANGE hook update. + +============= + Permissions +============= + - stargate.use - Allow this player/group to use stargates. + - stargate.create - Allow this player/group to create new stargates. + - stargate.destroy - Allow this player/group to destroy existing stargates. + - stargate.hidden - Allow this player/group to see all hidden stargates. -Installation: - - Move Stargate.jar to your /plugins/ location - - Setup Permissions - -Permissions: - - stargate.use - - Allow this player/group to use stargates. - - stargate.create - - Allow this player/group to create new stargates. - - stargate.destroy - - Allow this player/group to destroy existing stargates. - - stargate.hidden - - Allow this player/group to see all hidden stargates. - +============= +Instructions +============= Building a gate: OO O O - These are Obsidian blocks. You need 10. @@ -31,7 +36,7 @@ Building a gate: - Type a set destination name on the second line if desired. - Type a network name on the third line if desired. - Type any options on the 4th line if desired. - - Right click the sign block to initialize the gate as a Stargate. + - Right click the sign block to initialize the gate as a Stargate. (Bug Alert: Sign may not update right away) Sign Layout: - Line 1: Gate Name (Max 12 characters) @@ -45,11 +50,10 @@ Using a gate: - Step through. Fixed gates: - - Fixed gates are like normal gates, but only go to one destination. - - If you create two fixed gates that point to eachother, you will have a two-way portal. - - You can link fixed gates to normal gates, or to other fixed gates which can link to another fixed gate etc. You can't link a normal gate to a fixed gate though. - - Creating a fixed gate is the same as a normal gate, but you must specify the destination on the second line. - - Set the 4th line to "A" to enable an always-open fixed gate. + - Fixed gates go to only one set destination. + - Fixed gates can be linked to other fixed gates, or normal gates. A normal gate cannot open a portal to a fixed gate however. + - To create a fixed gate, specify a destination on the second line of the stargate sign. + - Set the 4th line of the stargate sign to "A" to enable an always-open fixed gate. Gate networks: - Gates are all part of a network, by default this is "central". @@ -58,8 +62,25 @@ Gate networks: Hidden Gates: - Hidden gates are like normal gates, but only show on the destination list of other gates under certain conditions. - - They are visible to anyone with the stargate.hidden permission, or to the creator of the hidden gate. - - Set the 4th line to "H" to make it a hidden gate. + - A hidden gate is only visible to the creator of the gate, or somebody with the stargate.hidden permission. + - Set the 4th line of the stargate sign to "H" to make it a hidden gate. -Configuration: - - You can edit all values in stargate.txt to your choosing, mostly the RP text on doing actions involving a gate. \ No newline at end of file +============== +Configuration +============== + - To change the text shown during events edit stargates.txt + +============= + Changes +============= +[Version 0.05] + - Moved Stargate files into the plugins/Stargate/ folder + - Added migration code so old gates/portals are ported to new folder structure + - Create default config.yml if it doesn't exist + - Fixed removing a gate, it is now completely removed +[Version 0.04] + - Updated to multi-world Bukkit +[Version 0.03] + - Changed package to net.TheDgtl.* + - Everything now uses Blox instead of Block objects + - Started on vehicle code, but it's still buggy \ No newline at end of file diff --git a/src/net/TheDgtl/Stargate/Portal.java b/src/net/TheDgtl/Stargate/Portal.java index 9537338..4aa4fde 100644 --- a/src/net/TheDgtl/Stargate/Portal.java +++ b/src/net/TheDgtl/Stargate/Portal.java @@ -516,7 +516,7 @@ public class Portal { lookupBlocks.remove(block); } // Include the sign and button - lookupBlocks.remove(id.getBlock()); + lookupBlocks.remove(new Blox(id.getBlock())); if (button != null) { lookupBlocks.remove(button); } diff --git a/src/net/TheDgtl/Stargate/Stargate.java b/src/net/TheDgtl/Stargate/Stargate.java index f0f495a..3399fd3 100644 --- a/src/net/TheDgtl/Stargate/Stargate.java +++ b/src/net/TheDgtl/Stargate/Stargate.java @@ -50,7 +50,8 @@ public class Stargate extends JavaPlugin implements Runnable { public static Logger log; private Configuration config; private PluginManager pm; - private static String portalFile = "stargates/locations.dat"; + private static String portalFile; + private static String gateFolder; private static String teleMsg = "Teleported"; private static String regMsg = "Gate Created"; private static String dmgMsg = "Gate Destroyed"; @@ -69,10 +70,9 @@ public class Stargate extends JavaPlugin implements Runnable { super(pluginLoader, instance, desc, folder, plugin, cLoader); log = Logger.getLogger("Minecraft"); - // Migrate old settings if applicable. - File oldFile = new File("stargates.txt"); - if (oldFile.exists()) - oldFile.renameTo(new File(portalFile)); + // Set portalFile and gateFolder to the plugin folder as defaults. + portalFile = folder + File.separator + "stargate.db"; + gateFolder = folder + File.separator + "gates" + File.separator; } public void onDisable() { @@ -92,6 +92,8 @@ public class Stargate extends JavaPlugin implements Runnable { pm.registerEvent(Event.Type.BLOCK_PHYSICS, blockListener, Priority.Normal, this); this.reloadConfig(); + this.migrate(); + this.reloadGates(); this.setupPermissions(); pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Normal, this); @@ -100,6 +102,7 @@ public class Stargate extends JavaPlugin implements Runnable { pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.VEHICLE_MOVE, vehicleListener, Priority.Normal, this); + //pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Priority.Normal, this); setInterval(160); // 8 seconds. @@ -109,18 +112,53 @@ public class Stargate extends JavaPlugin implements Runnable { public void reloadConfig() { config.load(); portalFile = config.getString("portal-save-location", portalFile); + gateFolder = config.getString("gate-folder", gateFolder); teleMsg = config.getString("teleport-message", teleMsg); regMsg = config.getString("portal-create-message", regMsg); dmgMsg = config.getString("portal-destroy-message", dmgMsg); denyMsg = config.getString("not-owner-message", denyMsg); invMsg = config.getString("not-selected-message", invMsg); blockMsg = config.getString("other-side-blocked-message", blockMsg); - defNetwork = config.getString("default-gate-network", defNetwork).trim(); + saveConfig(); + } + public void saveConfig() { + config.setProperty("portal-save-location", portalFile); + config.setProperty("gate-folder", gateFolder); + config.setProperty("teleport-message", teleMsg); + config.setProperty("portal-create-message", regMsg); + config.setProperty("portal-destroy-message", dmgMsg); + config.setProperty("not-owner-message", denyMsg); + config.setProperty("not-selected-message", invMsg); + config.setProperty("other-side-blocked-message", blockMsg); + config.setProperty("default-gate-network", defNetwork); + config.save(); + } + + public void reloadGates() { Gate.loadGates(); - //Portal.loadAllGates(this.getServer().getWorlds().get(0)); - Portal.loadAllGates(this.getServer().getWorlds()[0]); + Portal.loadAllGates(this.getServer().getWorlds().get(0)); + } + + private void migrate() { + // Migrate old stargates if applicable. + File oldFile = new File("stargates/locations.dat"); + if (oldFile.exists()) { + Stargate.log.info("[Stargate] Migrated existing locations.dat"); + oldFile.renameTo(new File(portalFile)); + } + + // Migrate old gates if applicaple + File oldDir = new File("stargates"); + if (oldDir.exists()) { + File newDir = new File(gateFolder); + if (!newDir.exists()) newDir.mkdirs(); + for (File file : oldDir.listFiles(new Gate.StargateFilenameFilter())) { + Stargate.log.info("[Stargate] Migrating existing gate " + file.getName()); + file.renameTo(new File(gateFolder + file.getName())); + } + } } public synchronized void doWork() { diff --git a/src/plugin.yml b/src/plugin.yml index bc5bac1..5c22a41 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Stargate main: net.TheDgtl.Stargate.Stargate -version: 0.03 +version: 0.05 description: Stargate mod for Bukkit author: Drakia website: http://www.thedgtl.net \ No newline at end of file