From 82eff21dbf10cd4becd7ad7313efb2c4c25f18cc Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Sat, 26 Nov 2011 00:35:07 -0700 Subject: [PATCH] Revert earlier changes about using the repo, fix awesome unload bug. Now you can't unload defaultly loaded worlds --- .gitmodules | 7 ++ lib/allpay | 1 + lib/commandhandler | 1 + pom.xml | 102 ++++++++++++++---- .../MultiverseCore/MultiverseCore.java | 2 +- .../commands/ImportCommand.java | 5 +- .../MultiverseCore/utils/WorldManager.java | 82 +++++++++----- 7 files changed, 150 insertions(+), 50 deletions(-) create mode 100644 .gitmodules create mode 160000 lib/allpay create mode 160000 lib/commandhandler diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..6c3a7c60 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +[submodule "lib/allpay"] + path = lib/allpay + url = git://github.com/FernFerret/AllPay.git +[submodule "lib/commandhandler"] + path = lib/commandhandler + url = git://github.com/PneumatiCraft/CommandHandler.git + branch = notrie diff --git a/lib/allpay b/lib/allpay new file mode 160000 index 00000000..18c55a90 --- /dev/null +++ b/lib/allpay @@ -0,0 +1 @@ +Subproject commit 18c55a9070a5e64b2cb0737940290643f324fa7d diff --git a/lib/commandhandler b/lib/commandhandler new file mode 160000 index 00000000..05cb1a3d --- /dev/null +++ b/lib/commandhandler @@ -0,0 +1 @@ +Subproject commit 05cb1a3d6200e16869f4f36c697e431549bd5d18 diff --git a/pom.xml b/pom.xml index a8e9ddc0..a3748cc0 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,28 @@ 1.6 + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + add-wsdl-source + generate-sources + + add-source + + + + ${project.basedir}/lib/allpay/src + ${project.basedir}/lib/commandhandler/src + ${project.basedir}/lib/commandhandler/lib/ShellParser/src + + + + + com.google.code.maven-replacer-plugin maven-replacer-plugin @@ -100,24 +122,6 @@ compile - - - com.pneumaticraft - CommandHandler - 3 - jar - compile - - - - - com.fernferret.allpay - AllPay - 3 - jar - compile - - org.getspout @@ -125,11 +129,68 @@ dev-SNAPSHOT + + + cosine.boseconomy + BOSEconomy + 0.6.2 + jar + compile + + + + fr.crafter.tickleman.RealShop + RealShop + 0.63 + jar + compile + + + + com.iCo6 + iConomy + 6.0 + jar + compile + + + + com.iConomy + iConomy + 5.0 + jar + compile + + + + com.nijiko.coelho.iConomy + iConomy + 4.65 + jar + compile + + + + com.earth2me.essentials + Essentials + 2.4.2 + jar + compile + + + me.ashtheking.currency + MultiCurrency + 0.09 + jar + compile + + org.junit junit 4.8.2 + test org.powermock @@ -158,6 +219,11 @@ 3.0 test + + junit + junit + 4.8.1 + diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index ae90e5c6..dda15dd5 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -113,7 +113,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { private DestinationFactory destFactory; private SpoutInterface spoutInterface = null; private double allpayversion = 3; - private double chversion = 1; + private double chversion = 3; private MVMessaging messaging; private File serverFolder = new File(System.getProperty("user.dir")); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java index 63aebd74..b601a91f 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java @@ -42,7 +42,6 @@ public class ImportCommand extends MultiverseCommand { * If it does, we can safely assume it's a world folder. * * @param worldFolder The File that may be a world. - * * @return True if it looks like a world, false if not. */ private boolean checkIfIsWorld(File worldFolder) { @@ -81,13 +80,14 @@ public class ImportCommand extends MultiverseCommand { @Override public void runCommand(CommandSender sender, List args) { String worldName = args.get(0); + if (worldName.toLowerCase().equals("--list") || worldName.toLowerCase().equals("-l")) { String worldList = this.getPotentialWorlds(); sender.sendMessage(worldList); return; } // Since we made an exception for the list, we have to make sure they have at least 2 params: - if(args.size() == 1) { + if (args.size() == 1) { this.showHelp(sender); return; } @@ -114,7 +114,6 @@ public class ImportCommand extends MultiverseCommand { Command.broadcastCommandMessage(sender, "Starting import of world '" + worldName + "'..."); this.worldManager.addWorld(worldName, environment, null, generator); Command.broadcastCommandMessage(sender, "Complete!"); - return; } else if (env == null) { sender.sendMessage(ChatColor.RED + "FAILED."); sender.sendMessage("That world type did not exist."); diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index 31fdf2ab..37591cf7 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -46,7 +46,9 @@ public class WorldManager implements MVWorldManager { } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public boolean addWorld(String name, Environment env, String seedString, String generator) { plugin.log(Level.FINE, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + generator); Long seed = null; @@ -106,7 +108,6 @@ public class WorldManager implements MVWorldManager { * Verifies that a given Plugin generator string exists. * * @param generator The name of the generator plugin. This should be something like CleanRoomGenerator. - * * @return True if the plugin exists and is enabled, false if not. */ private boolean pluginExists(String generator) { @@ -114,7 +115,9 @@ public class WorldManager implements MVWorldManager { return plugin != null && plugin.isEnabled(); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName) { if (generator == null) { return null; @@ -133,12 +136,13 @@ public class WorldManager implements MVWorldManager { * Remove the world from the Multiverse list and from the config * * @param name The name of the world to remove - * * @return True if success, false if failure. */ public boolean removeWorldFromConfig(String name) { + if (!unloadWorld(name)) { + return false; + } if (this.configWorlds.get("worlds." + name) != null) { - unloadWorld(name); this.plugin.log(Level.INFO, "World '" + name + "' was removed from config.yml"); this.configWorlds.set("worlds." + name, null); @@ -154,26 +158,32 @@ public class WorldManager implements MVWorldManager { return false; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public boolean unloadWorld(String name) { - if (this.worlds.containsKey(name)) { - this.worlds.remove(name); - this.plugin.log(Level.INFO, "World '" + name + "' was unloaded from memory."); - this.unloadWorldFromBukkit(name, true); - this.unloadedWorlds.add(name); - return true; + if (this.unloadWorldFromBukkit(name, true)) { + this.worlds.remove(name); + this.plugin.log(Level.INFO, "World '" + name + "' was unloaded from memory."); + this.unloadedWorlds.add(name); + return true; + } else { + this.plugin.log(Level.WARNING, "World '" + name + "' could not be unloaded. Is it a default world?"); + } } else if (this.plugin.getServer().getWorld(name) != null) { this.plugin.log(Level.WARNING, "Hmm Multiverse does not know about this world but it's loaded in memory."); this.plugin.log(Level.WARNING, "To unload it using multiverse, use:"); this.plugin.log(Level.WARNING, "/mv import " + name + " " + this.plugin.getServer().getWorld(name).getEnvironment().toString()); } else { - this.plugin.log(Level.INFO, "Multiverse does not know about " + name + "."); + this.plugin.log(Level.INFO, "Multiverse does not know about " + name + " and it's not loaded by Bukkit."); } return false; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public boolean loadWorld(String name) { // Check if the World is already loaded if (this.worlds.containsKey(name)) { @@ -204,14 +214,18 @@ public class WorldManager implements MVWorldManager { } } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public Boolean deleteWorld(String name) { World world = this.plugin.getServer().getWorld(name); if (world == null) { // We can only delete loaded worlds return false; } - removeWorldFromConfig(name); + if (!removeWorldFromConfig(name)) { + return false; + } try { File worldFile = world.getWorldFolder(); @@ -240,7 +254,6 @@ public class WorldManager implements MVWorldManager { * * @param name Name of the world to unload * @param safely Perform this safely. Set to True to save world files before unloading. - * * @return True if the world was unloaded, false if not. */ private boolean unloadWorldFromBukkit(String name, boolean safely) { @@ -248,7 +261,9 @@ public class WorldManager implements MVWorldManager { return this.plugin.getServer().unloadWorld(name, safely); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public void removePlayersFromWorld(String name) { World w = this.plugin.getServer().getWorld(name); if (w != null) { @@ -262,12 +277,16 @@ public class WorldManager implements MVWorldManager { } } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public Collection getMVWorlds() { return this.worlds.values(); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public MultiverseWorld getMVWorld(String name) { if (this.worlds.containsKey(name)) { @@ -276,7 +295,9 @@ public class WorldManager implements MVWorldManager { return this.getMVWorldByAlias(name); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public MultiverseWorld getMVWorld(World world) { if (world != null) { @@ -289,7 +310,6 @@ public class WorldManager implements MVWorldManager { * Returns a {@link MVWorld} if it exists, and null if it does not. This will search ONLY alias. * * @param alias The alias of the world to get. - * * @return A {@link MVWorld} or null. */ private MultiverseWorld getMVWorldByAlias(String alias) { @@ -301,13 +321,17 @@ public class WorldManager implements MVWorldManager { return null; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public boolean isMVWorld(String name) { return (this.worlds.containsKey(name) || isMVWorldAlias(name)); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public boolean isMVWorld(World world) { return world != null && this.isMVWorld(world.getName()); @@ -317,7 +341,6 @@ public class WorldManager implements MVWorldManager { * This method ONLY checks the alias of each world. * * @param alias The alias of the world to check. - * * @return True if the world exists, false if not. */ private boolean isMVWorldAlias(String alias) { @@ -329,7 +352,9 @@ public class WorldManager implements MVWorldManager { return false; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public void loadWorlds(boolean forceLoad) { // Basic Counter to count how many Worlds we are loading. int count = 0; @@ -402,7 +427,9 @@ public class WorldManager implements MVWorldManager { this.plugin.log(Level.INFO, count + " - World(s) loaded."); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public PurgeWorlds getWorldPurger() { return this.worldPurger; } @@ -411,7 +438,6 @@ public class WorldManager implements MVWorldManager { * Load the config from a file. * * @param file The file to load. - * * @return A loaded configuration. */ public FileConfiguration loadWorldConfig(File file) {