add MapParser#gerWorldFromName

This commit is contained in:
Spencer 2017-12-30 20:13:59 -05:00 committed by Alexander Meech
parent 6bfe49d894
commit 8e43b4506c

View File

@ -12,6 +12,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
@ -38,7 +39,7 @@ import mineplex.mapparser.command.CurrentlyLiveCommand;
import mineplex.mapparser.command.DeleteCommand;
import mineplex.mapparser.command.GameTypeCommand;
import mineplex.mapparser.command.HubCommand;
import mineplex.mapparser.command.InfoCommand;
import mineplex.mapparser.command.GameTypeInfoCommand;
import mineplex.mapparser.command.ItemNameCommand;
import mineplex.mapparser.command.ListCommand;
import mineplex.mapparser.command.LockCommand;
@ -125,7 +126,7 @@ public class MapParser extends JavaPlugin
commandModule.add(new ItemNameCommand(this));
commandModule.add(new AddLoreCommand(this));
commandModule.add(new ClearLoreCommand(this));
commandModule.add(new InfoCommand(this));
commandModule.add(new GameTypeInfoCommand(this));
commandModule.add(new LockCommand(this));
commandModule.add(new PlayerHeadCommand(this));
commandModule.add(new RefreshWorldEditCommand(this));
@ -447,4 +448,22 @@ public class MapParser extends JavaPlugin
{
_additionalText.add(s);
}
public World getWorldFromName(String worldName)
{
World world = getMapWorld(worldName);
if (world == null)
{
if (doesMapExist(worldName))
{
world = Bukkit.createWorld(new WorldCreator(worldName));
}
else
{
return null;
}
}
return world;
}
}