Simple Worlds API

Header


A lightweight solution for multiworld support. Enables creating, teleporting to, and deleting multiple worlds with a few simple commands


Simple Worlds API

Using the SimpleWorlds api couldn't be easier! Just extend SimpleWorlds.jar (make sure to include it as a dependency!) Here is a method demonstrating every feature in the api :

public void someMethod() {
		SimpleWorldAPI api = new SimpleWorldAPI();
		
		//create a world
		api.createWorld("sample_end_world", api.getEnvironmentFromString("end"), true);
		api.createWorld("sample_nether_world", api.getEnvironmentFromString("nether"), true);
		
		//unload world
		api.unloadWorld("sample_nether_world");
		
		//load world
		api.loadWorld("sample_nether_world", api.getEnvironmentFromString("nether"));
		
		//teleport player "Xacero" to sample_end_world
		Player xacero = Bukkit.getServer().getPlayer("Xacero");
		api.teleportEntityToWorld(xacero, "sample_end_world");
		
		//retrieve world from memory
		World someworld = api.getWorldByName("sample_nether_world");
		
		//check if world is loaded
		if (api.isWorldLoaded("sample_nether_world")) {
			// do stuff
		}
		
		//check if world exists
		if (api.doesWorldExist("sample_nether_world")) {
			// do stuff
		}
		
		//get all worlds in memory
		List<World> worlds = api.getLoadedWorlds();
		
		//delete world
		api.deleteWorld("sample_nether_world");
		
	}

Most methods return a boolean depending on success (list is the only exception)


Comments

Posts Quoted:
Reply
Clear All Quotes