Don't load worlds on startup for Upgrade process, use FakeWorld instead.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1455 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-14 02:02:15 +00:00
parent ea52e817b5
commit 4bd6bdcc39
3 changed files with 13 additions and 26 deletions

View file

@ -98,18 +98,6 @@ public class Essentials extends JavaPlugin
{
setStatic();
EssentialsUpgrade upgrade = new EssentialsUpgrade(this.getDescription().getVersion(), this);
if (newWorldsLoaded)
{
logger.log(Level.SEVERE, Util.i18n("worldsLoadedRestartServer"));
try
{
getServer().dispatchCommand(Console.getCommandSender(getServer()), "stop");
}
catch (Exception ex)
{
logger.log(Level.SEVERE, Util.i18n("failedStopServer"), ex);
}
}
confList = new ArrayList<IConf>();
settings = new Settings(this.getDataFolder());
confList.add(settings);
@ -655,17 +643,6 @@ public class Essentials extends JavaPlugin
{
return w;
}
File bukkitDirectory = getStatic().getDataFolder().getParentFile().getParentFile();
File worldDirectory = new File(bukkitDirectory, name);
if (worldDirectory.exists() && worldDirectory.isDirectory())
{
w = getServer().createWorld(name, World.Environment.NORMAL);
if (w != null)
{
newWorldsLoaded = true;
}
return w;
}
return null;
}

View file

@ -207,7 +207,7 @@ public class EssentialsUpgrade
World world = ess.getServer().getWorlds().get(0);
if (vals.size() > 5)
{
world = ess.getWorld((String)vals.get(5));
world = getFakeWorld((String)vals.get(5));
}
if (world != null)
{
@ -258,12 +258,11 @@ public class EssentialsUpgrade
break;
}
}
boolean forceWorldName = false;
if (worldName != null)
{
worldName.trim();
World w1 = null;
w1 = ess.getWorld(worldName);
w1 = getFakeWorld(worldName);
if (w1 != null)
{
w = w1;
@ -366,4 +365,15 @@ public class EssentialsUpgrade
}
}
}
private World getFakeWorld(String name)
{
File bukkitDirectory = ess.getDataFolder().getParentFile().getParentFile();
File worldDirectory = new File(bukkitDirectory, name);
if (worldDirectory.exists() && worldDirectory.isDirectory())
{
return new FakeWorld(worldDirectory.getName(), World.Environment.NORMAL);
}
return null;
}
}