From 71bfd2a1ad21964bfa2f2639002ad24a7ff91f8d Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Fri, 25 Nov 2011 22:45:27 -0700 Subject: [PATCH] Remove submodules in favor of deployments --- .gitmodules | 7 -- lib/allpay | 1 - lib/commandhandler | 1 - pom.xml | 102 ++++-------------- .../commands/ImportCommand.java | 54 +++++++++- 5 files changed, 71 insertions(+), 94 deletions(-) delete mode 100644 .gitmodules delete mode 160000 lib/allpay delete mode 160000 lib/commandhandler diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 6c3a7c60..00000000 --- a/.gitmodules +++ /dev/null @@ -1,7 +0,0 @@ -[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 deleted file mode 160000 index 18c55a90..00000000 --- a/lib/allpay +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 18c55a9070a5e64b2cb0737940290643f324fa7d diff --git a/lib/commandhandler b/lib/commandhandler deleted file mode 160000 index 50ecf6af..00000000 --- a/lib/commandhandler +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 50ecf6af450d138a9bc562c1c5664b31be6ffd2f diff --git a/pom.xml b/pom.xml index a3748cc0..a8e9ddc0 100644 --- a/pom.xml +++ b/pom.xml @@ -47,28 +47,6 @@ 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 @@ -122,6 +100,24 @@ compile + + + com.pneumaticraft + CommandHandler + 3 + jar + compile + + + + + com.fernferret.allpay + AllPay + 3 + jar + compile + + org.getspout @@ -129,68 +125,11 @@ 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 @@ -219,11 +158,6 @@ 3.0 test - - junit - junit - 4.8.1 - diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java index 05b15439..35a16bfd 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java @@ -16,6 +16,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.permissions.PermissionDefault; import java.io.File; +import java.io.FilenameFilter; import java.util.List; public class ImportCommand extends MultiverseCommand { @@ -25,7 +26,7 @@ public class ImportCommand extends MultiverseCommand { super(plugin); this.setName("Import World"); this.setCommandUsage("/mv import" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]"); - this.setArgRange(2, 3); + this.setArgRange(1, 3); this.addKey("mvimport"); this.addKey("mvim"); this.addKey("mv import"); @@ -36,9 +37,60 @@ public class ImportCommand extends MultiverseCommand { this.worldManager = this.plugin.getMVWorldManager(); } + /** + * A very basic check to see if a folder has a level.dat file. + * 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) { + if (worldFolder.isDirectory()) { + File[] files = worldFolder.listFiles(new FilenameFilter() { + @Override + public boolean accept(File file, String name) { + return name.equalsIgnoreCase("level.dat"); + } + }); + if (files.length > 0) { + return true; + } + } + return false; + } + + private String getPotentialWorlds() { + File worldFolder = this.plugin.getServer().getWorldContainer(); + File[] files = worldFolder.listFiles(); + String worldList = ""; + ChatColor currColor = ChatColor.WHITE; + for (File file : files) { + if (file.isDirectory() && checkIfIsWorld(file)) { + worldList += currColor + file.getName() + " "; + if (currColor == ChatColor.WHITE) { + currColor = ChatColor.YELLOW; + } else { + currColor = ChatColor.WHITE; + } + } + } + return worldList; + } + @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) { + + return; + } File worldFile = new File(this.plugin.getServerFolder(), worldName); if (this.worldManager.isMVWorld(worldName) && worldFile.exists()) { sender.sendMessage(ChatColor.RED + "Multiverse already knows about this world!");