本文整理汇总了Java中org.bukkit.WorldType类的典型用法代码示例。如果您正苦于以下问题:Java WorldType类的具体用法?Java WorldType怎么用?Java WorldType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WorldType类属于org.bukkit包,在下文中一共展示了WorldType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WorldCreatorData
import org.bukkit.WorldType; //导入依赖的package包/类
public WorldCreatorData(
Optional<String> name,
@Nullable Dimension dimension,
Optional<Long> seed,
@Nullable WorldType type,
Optional<ChunkGenerator> generator,
@Nullable String generatorSettings,
@Nullable Boolean structures
) {
if (name == null) {
throw new IllegalArgumentException("The name of a creator cannot be null!");
}
this.name = name;
this.dimension = Optional.ofNullable(dimension).orElse(Dimension.NORMAL);
this.type = Optional.ofNullable(type).orElse(WorldType.NORMAL);
this.seed = seed;
this.generator = generator;
this.generatorSettings = Optional.ofNullable(generatorSettings).orElse("");
this.structures = Optional.ofNullable(structures).orElse(true);
}
示例2: withGeneratorID
import org.bukkit.WorldType; //导入依赖的package包/类
public static WorldCreatorData withGeneratorID(
Optional<String> name,
@Nullable Dimension dimension,
Optional<Long> seed,
@Nullable WorldType type,
String generatorID,
@Nullable String generatorSettings,
@Nullable Boolean structures
) {
return new WorldCreatorData(
name,
dimension,
seed,
type,
Optional.ofNullable(generatorID).map(ChunkGeneratorWithID::getGenerator),
generatorSettings,
structures
);
}
示例3: getBeaconzWorld
import org.bukkit.WorldType; //导入依赖的package包/类
/**
* Get the world that Beaconz runs in and if it doesn't exist, make it
* @return
*/
public World getBeaconzWorld() {
// Check to see if the world exists, and if not, make it
if (beaconzWorld == null) {
// World doesn't exist, so make it
getLogger().info("World is '" + Settings.worldName + "'");
try {
beaconzWorld = WorldCreator.name(Settings.worldName).type(WorldType.NORMAL).environment(World.Environment.NORMAL).createWorld();
} catch (Exception e) {
getLogger().info("Could not make world yet..");
return null;
}
if (!beaconzWorld.getPopulators().contains(getBp())) {
beaconzWorld.getPopulators().add(getBp());
}
}
// This is not allowed in this function as it can be called async
//beaconzWorld.setSpawnLocation(Settings.xCenter, beaconzWorld.getHighestBlockYAt(Settings.xCenter, Settings.zCenter), Settings.zCenter);
return beaconzWorld;
}
示例4: createWorld
import org.bukkit.WorldType; //导入依赖的package包/类
public void createWorld(String name, long seed, String generator, Environment env, WorldType type, boolean genStructures, boolean providedSeed) {
name = name.toLowerCase();
World w = this.createBukkitWorld(name, seed, generator, env, type, genStructures, providedSeed);
this.database.setValue("worlds." + name + ".seed", seed);
if(generator != null) {
this.database.setValue("worlds." + name + ".generator", generator);
}
this.database.setValue("worlds." + name + ".environment", env.name());
this.database.setValue("worlds." + name + ".type", type.name());
this.database.setValue("worlds." + name + ".generateStructures", genStructures);
this.database.setValue("worlds." + name + ".pvp", false);
this.database.setValue("worlds." + name + ".difficulty", Difficulty.EASY.name());
this.database.setValue("worlds." + name + ".gamemode", GameMode.SURVIVAL.name());
WorldData world = new WorldData(this.module, this, name);
world.setWorld(w);
this.worlds.put(name, world);
}
示例5: getWorld
import org.bukkit.WorldType; //导入依赖的package包/类
public World getWorld() {
if (uSkyBlock.skyBlockWorld == null) {
skyBlockWorld = Bukkit.getWorld(Settings.general_worldName);
ChunkGenerator skyGenerator = getGenerator();
ChunkGenerator worldGenerator = skyBlockWorld != null ? skyBlockWorld.getGenerator() : null;
if (skyBlockWorld == null || skyBlockWorld.canGenerateStructures() ||
worldGenerator == null || !worldGenerator.getClass().getName().equals(skyGenerator.getClass().getName()))
{
uSkyBlock.skyBlockWorld = WorldCreator
.name(Settings.general_worldName)
.type(WorldType.NORMAL)
.generateStructures(false)
.environment(World.Environment.NORMAL)
.generator(skyGenerator)
.createWorld();
uSkyBlock.skyBlockWorld.save();
}
MultiverseCoreHandler.importWorld(skyBlockWorld);
setupWorld(skyBlockWorld, island_height);
}
return uSkyBlock.skyBlockWorld;
}
示例6: getSkyBlockNetherWorld
import org.bukkit.WorldType; //导入依赖的package包/类
public World getSkyBlockNetherWorld() {
if (skyBlockNetherWorld == null && Settings.nether_enabled) {
skyBlockNetherWorld = Bukkit.getWorld(Settings.general_worldName + "_nether");
ChunkGenerator skyGenerator = getNetherGenerator();
ChunkGenerator worldGenerator = skyBlockNetherWorld != null ? skyBlockNetherWorld.getGenerator() : null;
if (skyBlockNetherWorld == null || skyBlockNetherWorld.canGenerateStructures() ||
worldGenerator == null || !worldGenerator.getClass().getName().equals(skyGenerator.getClass().getName())) {
uSkyBlock.skyBlockNetherWorld = WorldCreator
.name(Settings.general_worldName + "_nether")
.type(WorldType.NORMAL)
.generateStructures(false)
.environment(World.Environment.NETHER)
.generator(skyGenerator)
.createWorld();
uSkyBlock.skyBlockNetherWorld.save();
}
MultiverseCoreHandler.importNetherWorld(skyBlockNetherWorld);
setupWorld(skyBlockNetherWorld, island_height / 2);
MultiverseInventoriesHandler.linkWorlds(getWorld(), skyBlockNetherWorld);
}
return skyBlockNetherWorld;
}
示例7: createArenaWorld
import org.bukkit.WorldType; //导入依赖的package包/类
private static World createArenaWorld(ConfigArena arena, String name) {
World world;
world = Bukkit.getServer().getWorld(name);
if (world == null) {
WorldCreator wc = new WorldCreator(name);
wc.environment(Environment.NORMAL);
wc.type(WorldType.FLAT);
wc.generateStructures(false);
world = Bukkit.getServer().createWorld(wc);
world.setAutoSave(false);
world.setSpawnFlags(false, false);
world.setKeepSpawnInMemory(false);
ChunkCoord.addWorld(world);
}
return world;
}
示例8: getNetherWorld
import org.bukkit.WorldType; //导入依赖的package包/类
/**
* @return the netherWorld
*/
public static World getNetherWorld() {
if (netherWorld == null && Settings.createNether) {
if (Settings.useOwnGenerator) {
return Bukkit.getServer().getWorld(Settings.worldName +"_nether");
}
if (plugin.getServer().getWorld(Settings.worldName + "_nether") == null) {
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether...");
}
if (!Settings.newNether) {
netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
} else {
netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.FLAT).generator(new ChunkGeneratorWorld())
.environment(World.Environment.NETHER).createWorld();
}
netherWorld.setMonsterSpawnLimit(Settings.monsterSpawnLimit);
netherWorld.setAnimalSpawnLimit(Settings.animalSpawnLimit);
}
return netherWorld;
}
示例9: create
import org.bukkit.WorldType; //导入依赖的package包/类
public void create() {
arenaWorld = plugin.getServer().getWorld(Statics.ARENA_WORLD_NAME);
if (arenaWorld == null) {
plugin.getLogger().info("Loading world '" + Statics.ARENA_WORLD_NAME + "'.");
WorldCreator arenaWorldCreator = new WorldCreator(Statics.ARENA_WORLD_NAME);
arenaWorldCreator.generateStructures(false);
arenaWorldCreator.generator(new VoidGenerator());
arenaWorldCreator.type(WorldType.FLAT);
arenaWorldCreator.seed(0);
arenaWorld = arenaWorldCreator.createWorld();
plugin.getLogger().info("Done loading world '" + Statics.ARENA_WORLD_NAME + "'.");
} else {
plugin.getLogger().info("The world '" + Statics.ARENA_WORLD_NAME + "' was already loaded.");
}
arenaWorld.setAutoSave(false);
arenaWorld.getBlockAt(-5000, 45, -5000).setType(Material.STONE);
arenaWorld.setSpawnLocation(-5000, 50, -5000);
for (Map.Entry<String, String> entry : plugin.getConfiguration().getArenaGamerules().entrySet()) {
arenaWorld.setGameRuleValue(entry.getKey(), entry.getValue());
}
arenaWorld.setTime(4000);
}
示例10: IslandWorld
import org.bukkit.WorldType; //导入依赖的package包/类
/**
* Generates the Skyblock worlds.
*/
public IslandWorld(BSkyBlock plugin) {
if (Settings.useOwnGenerator) {
// Do nothing
return;
}
if (plugin.getServer().getWorld(Settings.worldName) == null) {
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Island World...");
}
// Create the world if it does not exist
islandWorld = WorldCreator.name(Settings.worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(new ChunkGeneratorWorld())
.createWorld();
// Make the nether if it does not exist
if (Settings.netherGenerate) {
if (plugin.getServer().getWorld(Settings.worldName + "_nether") == null) {
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether...");
}
if (!Settings.netherIslands) {
netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
} else {
netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.FLAT).generator(new ChunkGeneratorWorld())
.environment(World.Environment.NETHER).createWorld();
}
}
// Make the end if it does not exist
if (Settings.endGenerate) {
if (plugin.getServer().getWorld(Settings.worldName + "_the_end") == null) {
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s End World...");
}
if (!Settings.endIslands) {
endWorld = WorldCreator.name(Settings.worldName + "_the_end").type(WorldType.NORMAL).environment(World.Environment.THE_END).createWorld();
} else {
endWorld = WorldCreator.name(Settings.worldName + "_the_end").type(WorldType.FLAT).generator(new ChunkGeneratorWorld())
.environment(World.Environment.THE_END).createWorld();
}
}
fixMultiverse(plugin);
}
示例11: loadLocalWorld
import org.bukkit.WorldType; //导入依赖的package包/类
/**
* Loads a local world
*
* @param name the world to load
* @return the loaded world
* @throws WorldException if the world is not found or something else goes wrong
*/
@Nonnull
public World loadLocalWorld(@Nonnull String name) {
org.bukkit.WorldCreator wc = new WorldCreator(name);
wc.environment(World.Environment.NORMAL); //TODO do we need support for environment in maps?
wc.generateStructures(false);
wc.type(WorldType.NORMAL);
wc.generator(new CleanRoomChunkGenerator());
wc.generatorSettings("");
World world = wc.createWorld();
world.setAutoSave(false);
return world;
}
示例12: loadLocalWorld
import org.bukkit.WorldType; //导入依赖的package包/类
@Override
public void loadLocalWorld(@Nonnull String name) {
WorldCreator wc = new WorldCreator(name);
wc.environment(World.Environment.NORMAL); //TODO do we need support for environment in maps?
wc.generateStructures(false);
wc.type(WorldType.NORMAL);
wc.generator(new CleanRoomChunkGenerator());
wc.generatorSettings("");
World world = wc.createWorld();
world.setAutoSave(false);
}
示例13: get
import org.bukkit.WorldType; //导入依赖的package包/类
@Override
protected WorldCreatorData[] get(Event event) {
Optional<String> name = Optional.ofNullable(nameExpr).map(expr -> expr.getSingle(event));
Logging.debug(this, "Creator Name: " + name);
Dimension dimension = Optional.ofNullable(dimensionExpr).map(expr -> expr.getSingle(event)).orElse(null);
Optional<Long> seed = Optional.ofNullable(seedExpr).map(expr -> Long.parseLong(expr.getSingle(event)));
WorldType type = Optional.ofNullable(typeExpr).map(expr -> expr.getSingle(event)).orElse(null);
String generator = Optional.ofNullable(generatorExpr).map(expr -> expr.getSingle(event)).orElse(null);
String generatorSettings = Optional.ofNullable(generatorSettingsExpr).map(expr -> expr.getSingle(event)).orElse(null);
Boolean structures = Optional.ofNullable(structuresExpr).map(expr -> expr.getSingle(event)).orElse(null);
return new WorldCreatorData[]{WorldCreatorData.withGeneratorID(name, dimension, seed, type, generator, generatorSettings, structures)};
}
示例14: init
import org.bukkit.WorldType; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
nameExpr = (Expression<String>) expressions[0];
dimensionExpr = (Expression<Dimension>) expressions[1];
seedExpr = (Expression<String>) expressions[2];
typeExpr = (Expression<WorldType>) expressions[3];
generatorExpr = (Expression<String>) expressions[4];
generatorSettingsExpr = (Expression<String>) expressions[5];
structuresExpr = (Expression<Boolean>) expressions[6];
return true;
}
示例15: fromJSON
import org.bukkit.WorldType; //导入依赖的package包/类
public static Optional<WorldCreatorData> fromJSON(Optional<String> worldName, JSONObject jsonObject) {
try {
Dimension dimension = Dimension.valueOf((String) jsonObject.get("environment"));
Optional<Long> seed = Optional.ofNullable((String) jsonObject.get("seed")).map(Long::parseLong);
WorldType type = WorldType.valueOf((String) jsonObject.get("worldtype"));
String generatorID = (String) jsonObject.get("generator");
String generatorSettings = (String) jsonObject.get("generatorsettings");
Boolean structures = (Boolean) jsonObject.get("structures");
return Optional.of(withGeneratorID(worldName, dimension, seed, type, generatorID, generatorSettings, structures));
} catch (ClassCastException e) {
return Optional.empty();
}
}