本文整理了Java中org.bukkit.Server.createWorld()
方法的一些代码示例,展示了Server.createWorld()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.createWorld()
方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:createWorld
[英]Creates or loads a world with the given name using the specified options.
If the world is already loaded, it will just return the equivalent of getWorld(creator.name()).
[中]使用指定的选项创建或加载具有给定名称的世界。
如果world已经加载,它将只返回与getWorld(creator.name())等价的值。
代码示例来源:origin: Bukkit/Bukkit
/**
* @see Server#createWorld(WorldCreator options)
*/
public static World createWorld(WorldCreator options) {
return server.createWorld(options);
}
代码示例来源:origin: SpigotMC/Spigot-API
/**
* @see Server#createWorld(WorldCreator options)
*/
public static World createWorld(WorldCreator options) {
return server.createWorld(options);
}
代码示例来源:origin: echurchill/CityWorld
public World getDefaultCityWorld(WorldStyle style, Environment environment) {
// built yet?
String worldName = getDefaultWorldName(style, environment);
World cityWorldPrime = Bukkit.getServer().getWorld(worldName);
if (cityWorldPrime == null) {
// if neither then create/build it!
WorldCreator worldcreator = new WorldCreator(worldName);
// worldcreator.seed(-7457540200860308014L); // Beta seed
// worldcreator.seed(5509442565638151977L); // 82,-35
worldcreator.environment(environment);
worldcreator.generator(new CityWorldGenerator(plugin, worldName, style.toString()));
cityWorldPrime = Bukkit.getServer().createWorld(worldcreator);
}
return cityWorldPrime;
}
}
代码示例来源:origin: TotalFreedom/TotalFreedomMod
@Override
protected World generateWorld()
{
final WorldCreator worldCreator = new WorldCreator(getName());
worldCreator.generateStructures(false);
worldCreator.type(WorldType.NORMAL);
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generator(new CleanroomChunkGenerator(GENERATION_PARAMETERS));
final World world = Bukkit.getServer().createWorld(worldCreator);
world.setSpawnFlags(false, false);
world.setSpawnLocation(0, 50, 0);
final Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST);
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
signData.setFacingDirection(BlockFace.NORTH);
welcomeSign.setLine(0, ChatColor.GREEN + "AdminWorld");
welcomeSign.setLine(1, ChatColor.DARK_GRAY + "---");
welcomeSign.setLine(2, ChatColor.YELLOW + "Spawn Point");
welcomeSign.setLine(3, ChatColor.DARK_GRAY + "---");
welcomeSign.update();
plugin.gr.commitGameRules();
return world;
}
代码示例来源:origin: TotalFreedom/TotalFreedomMod
@Override
protected World generateWorld()
{
if (!ConfigEntry.FLATLANDS_GENERATE.getBoolean())
{
return null;
}
wipeFlatlandsIfFlagged();
final WorldCreator worldCreator = new WorldCreator(getName());
worldCreator.generateStructures(false);
worldCreator.type(WorldType.NORMAL);
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generator(new CleanroomChunkGenerator(GENERATION_PARAMETERS));
final World world = Bukkit.getServer().createWorld(worldCreator);
world.setSpawnFlags(false, false);
world.setSpawnLocation(0, 50, 0);
final Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST);
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
signData.setFacingDirection(BlockFace.NORTH);
welcomeSign.setLine(0, ChatColor.GREEN + "Flatlands");
welcomeSign.setLine(1, ChatColor.DARK_GRAY + "---");
welcomeSign.setLine(2, ChatColor.YELLOW + "Spawn Point");
welcomeSign.setLine(3, ChatColor.DARK_GRAY + "---");
welcomeSign.update();
plugin.gr.commitGameRules();
return world;
}
内容来源于网络,如有侵权,请联系作者删除!