mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 02:25:41 +01:00
Revert earlier changes about using the repo, fix awesome unload bug. Now you can't unload defaultly loaded worlds
This commit is contained in:
parent
6bf9d1c9bb
commit
82eff21dbf
7
.gitmodules
vendored
Normal file
7
.gitmodules
vendored
Normal file
@ -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
|
1
lib/allpay
Submodule
1
lib/allpay
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 18c55a9070a5e64b2cb0737940290643f324fa7d
|
1
lib/commandhandler
Submodule
1
lib/commandhandler
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 05cb1a3d6200e16869f4f36c697e431549bd5d18
|
102
pom.xml
102
pom.xml
@ -47,6 +47,28 @@
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Build Helper - Additional Source Folders -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-wsdl-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.basedir}/lib/allpay/src</source>
|
||||
<source>${project.basedir}/lib/commandhandler/src</source>
|
||||
<source>${project.basedir}/lib/commandhandler/lib/ShellParser/src</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
<artifactId>maven-replacer-plugin</artifactId>
|
||||
@ -100,24 +122,6 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Bukkit Dependency -->
|
||||
<!-- CommandHandler Dependency -->
|
||||
<dependency>
|
||||
<groupId>com.pneumaticraft</groupId>
|
||||
<artifactId>CommandHandler</artifactId>
|
||||
<version>3</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- CommandHandler Dependency -->
|
||||
<!-- AllPay Dependency -->
|
||||
<dependency>
|
||||
<groupId>com.fernferret.allpay</groupId>
|
||||
<artifactId>AllPay</artifactId>
|
||||
<version>3</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- AllPay Dependency -->
|
||||
<!-- Start of Spout -->
|
||||
<dependency>
|
||||
<groupId>org.getspout</groupId>
|
||||
@ -125,11 +129,68 @@
|
||||
<version>dev-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- End of Spout -->
|
||||
<!-- Start of Economy Dependencies -->
|
||||
<dependency>
|
||||
<groupId>cosine.boseconomy</groupId>
|
||||
<artifactId>BOSEconomy</artifactId>
|
||||
<version>0.6.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>fr.crafter.tickleman.RealShop</groupId>
|
||||
<artifactId>RealShop</artifactId>
|
||||
<version>0.63</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.iCo6</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>6.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.iConomy</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>5.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.nijiko.coelho.iConomy</groupId>
|
||||
<artifactId>iConomy</artifactId>
|
||||
<version>4.65</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.earth2me.essentials</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.4.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.ashtheking.currency</groupId>
|
||||
<artifactId>MultiCurrency</artifactId>
|
||||
<version>0.09</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End of Economy Dependencies -->
|
||||
<!-- Start of Test Dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
@ -158,6 +219,11 @@
|
||||
<version>3.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.1</version>
|
||||
</dependency>
|
||||
<!-- End of Test Dependencies -->
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -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"));
|
||||
|
@ -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<String> 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.");
|
||||
|
@ -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<MultiverseWorld> 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user