Java Code Examples for org.bukkit.World#Environment

The following examples show how to use org.bukkit.World#Environment . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CraftServer.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public World createWorld(String name, World.Environment environment) {
    return WorldCreator.name(name).environment(environment).createWorld();
}
 
Example 2
Source File: CraftServer.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public World createWorld(String name, World.Environment environment, long seed) {
    return WorldCreator.name(name).environment(environment).seed(seed).createWorld();
}
 
Example 3
Source File: CreateCmd.java    From SkyWarsReloaded with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean run() {
	if (SkyWarsReloaded.getCfg().getSpawn() != null) {
		String worldName = args[1];
		World.Environment environment = World.Environment.NORMAL;
		if (args.length > 2) {
			if (args[2].equalsIgnoreCase("the_end")) {
				environment = World.Environment.THE_END;
			} else if (args[2].equalsIgnoreCase("nether")) {
				environment = World.Environment.NETHER;
			}
		}

		GameMap gMap = GameMap.getMap(worldName);
		if (gMap != null) {
			player.sendMessage(new Messaging.MessageFormatter().format("error.map-exists"));
			return true;
		}
			World result = GameMap.createNewMap(worldName, environment);
			if (result == null) {
				player.sendMessage(new Messaging.MessageFormatter().format("error.map-world-exists"));
				return true;
			} else {
				player.sendMessage(new Messaging.MessageFormatter().setVariable("mapname", worldName).format("maps.created"));
				gMap = GameMap.getMap(worldName);
				if (gMap != null) {
                       gMap.setEditing(true);
					World editWorld = SkyWarsReloaded.get().getServer().getWorld(worldName);
					editWorld.setAutoSave(true);
                       player.setGameMode(GameMode.CREATIVE);
                       result.getBlockAt(0, 75, 0).setType(Material.STONE);
                       player.teleport(new Location(result, 0, 76, 0), TeleportCause.PLUGIN);
                       player.setAllowFlight(true);
                       player.setFlying(true);
                   }
                   return true;
			}
	} else {
		sender.sendMessage(new Messaging.MessageFormatter().format("error.nospawn"));
		return false;
	}
}