本文整理汇总了Java中org.bukkit.WorldCreator.generator方法的典型用法代码示例。如果您正苦于以下问题:Java WorldCreator.generator方法的具体用法?Java WorldCreator.generator怎么用?Java WorldCreator.generator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.WorldCreator
的用法示例。
在下文中一共展示了WorldCreator.generator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
protected void execute(Event e) {
Boolean FAWE = false;
if (Bukkit.getWorld(world.getSingle(e)) != null) {
Bukkit.unloadWorld(world.getSingle(e), true);
}
if (parsedSyntax.contains("async") && Skellett.instance.getConfig().getBoolean("Async", false)) FAWE = true;
if (FAWE) {
AsyncWorld FAWEworld = AsyncWorld.create(new WorldCreator(world.getSingle(e)));
FAWEworld.commit();
} else {
WorldCreator creator = new WorldCreator(world.getSingle(e));
if (generator != null) {
creator.generator(generator.getSingle(e));
}
creator.createWorld();
}
}
示例2: loadWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public World loadWorld(String worldName) {
World world = plugin.getServer().getWorld(worldName);
if (world == null) {
File worldDir = new File(worldName);
if (worldDir.exists() && worldDir.isDirectory()) {
WorldCreator creator = WorldCreator.name(worldName).seed(0).
environment(World.Environment.NORMAL);
creator.generator(getEmptyWorldGenerator());
world = Bukkit.createWorld(creator);
}
}
if (world != null) {
setDefaults(world);
}
return world;
}
示例3: create
import org.bukkit.WorldCreator; //导入方法依赖的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);
}
示例4: loadLocalWorld
import org.bukkit.WorldCreator; //导入方法依赖的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);
}
示例5: createWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
public World createWorld(WorldCreator creator) {
World alreadyLoaded = this.getWorld(creator.name());
if (alreadyLoaded != null) {
return alreadyLoaded;
}
if (nukkit.isLevelGenerated(creator.name())) {
nukkit.loadLevel(creator.name());
World alreadyGenerated = this.getWorld(creator.name());
return alreadyGenerated;
}
if (creator.environment() != Environment.NORMAL) {
throw new IllegalArgumentException("No Nether or End support yet");
}
if (creator.generator() != null) {
throw new IllegalArgumentException("Custom generators are not yet supported");
}
Map<String, Object> options = new HashMap<>();
options.put("preset", creator.generatorSettings());
if (!nukkit.generateLevel(creator.name(), creator.seed(), PokkitWorldType.toNukkit(creator.type()), options)) {
throw new RuntimeException("Failed to create world " + creator.name());
}
World world = this.getWorld(creator.name());
Pokkit.assertion(world != null, "World was still null");
return world;
}
示例6: createWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
private World createWorld(String worldName) {
World world = loadWorld(worldName);
if (world == null) {
Random r = new Random();
long seed = (long) (r.nextDouble() * Long.MAX_VALUE);
World.Environment e = World.Environment.NORMAL;
WorldCreator creator = WorldCreator.name(worldName).seed(seed).environment(e);
creator.generator(getEmptyWorldGenerator());
world = Bukkit.createWorld(creator);
setDefaults(world);
}
return world;
}
示例7: createBukkitWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
private World createBukkitWorld(String name, long seed, String generator, Environment env, WorldType type, boolean genStructures, boolean providedSeed) {
WorldCreator c = new WorldCreator(name);
if(providedSeed) {
c.seed(seed);
}
if(generator != null) {
c.generator(generator);
}
c.environment(env);
c.type(type);
c.generateStructures(genStructures);
return c.createWorld();
}
示例8: loadBukkitWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
private void loadBukkitWorld(WorldData world) {
WorldCreator c = new WorldCreator(world.getName());
c.seed(world.getSeed());
if(world.hasGenerator()) {
c.generator(world.getGenerator());
}
c.environment(world.getEnvironment());
c.type(world.getType());
c.generateStructures(world.generateStructures());
c.createWorld();
}
示例9: MapManager
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public MapManager(Annihilation plugin, MapLoader loader, Configuration config) {
mapLoader = loader;
for (String s : config.getKeys(false)) {
if (!s.equalsIgnoreCase("lobby"))
maps.add(s);
}
WorldCreator wc = new WorldCreator("lobby");
wc.generator(new VoidGenerator());
Bukkit.createWorld(wc);
lobbySpawn = parseLocation(config.getString("lobby.spawn"));
}
示例10: loadIntoGame
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public boolean loadIntoGame(String worldName) {
mapLoader.loadMap(worldName);
WorldCreator wc = new WorldCreator(worldName);
wc.generator(new VoidGenerator());
world = Bukkit.createWorld(wc);
return true;
}
示例11: generateWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
protected World generateWorld()
{
if (!TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
{
return null;
}
wipeFlatlandsIfFlagged();
WorldCreator worldCreator = new WorldCreator(WORLD_NAME);
worldCreator.generateStructures(false);
worldCreator.type(WorldType.NORMAL);
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generator(new CleanroomChunkGenerator(GENERATION_PARAMETERS));
World world = Bukkit.getServer().createWorld(worldCreator);
world.setSpawnFlags(false, false);
world.setSpawnLocation(0, 50, 0);
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();
TFM_GameRuleHandler.commitGameRules();
return world;
}
示例12: MapManager
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public MapManager(CrafterNexus plugin, MapRollback loader, Configuration config) {
mapLoader = loader;
for (String s : config.getKeys(false)) {
if (!s.equalsIgnoreCase("lobby"))
maps.add(s);
}
WorldCreator wc = new WorldCreator("lobby");
wc.generator(new VoidGenerator());
Bukkit.createWorld(wc);
lobbySpawn = parseLocation(config.getString("lobby.spawn"));
}
示例13: getMap
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public static World getMap() {
WorldCreator wc = new WorldCreator(WORLD_NAME);
wc.environment(Environment.NORMAL);
wc.generator(new ChristmasChunkGenerator());
wc.createWorld();
World world = Bukkit.getWorld(WORLD_NAME);
if (map == null) {
map = Bukkit.getServer().createWorld(wc);
}
return world;
}
示例14: createWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
public World createWorld(WorldCreator creator) {
Validate.notNull(creator, "Creator may not be null");
String name = creator.name();
ChunkGenerator generator = creator.generator();
File folder = new File(getWorldContainer(), name);
World world = getWorld(name);
net.minecraft.world.WorldType type = net.minecraft.world.WorldType.parseWorldType(creator.type().getName());
boolean generateStructures = creator.generateStructures();
if ((folder.exists()) && (!folder.isDirectory())) {
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
}
if (world != null) {
return world;
}
boolean hardcore = false;
WorldSettings worldSettings = new WorldSettings(creator.seed(), net.minecraft.world.WorldSettings.GameType.getByID(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
net.minecraft.world.WorldServer worldserver = DimensionManager.initDimension(creator, worldSettings);
pluginManager.callEvent(new WorldInitEvent(worldserver.getWorld()));
net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = true;
System.out.print("Preparing start region for level " + (console.worlds.size() - 1) + " (Dimension: " + worldserver.provider.dimensionId + ", Seed: " + worldserver.getSeed() + ")"); // Cauldron - log dimension
if (worldserver.getWorld().getKeepSpawnInMemory()) {
short short1 = 196;
long i = System.currentTimeMillis();
for (int j = -short1; j <= short1; j += 16) {
for (int k = -short1; k <= short1; k += 16) {
long l = System.currentTimeMillis();
if (l < i) {
i = l;
}
if (l > i + 1000L) {
int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;
System.out.println("Preparing spawn area for " + worldserver.getWorld().getName() + ", " + (j1 * 100 / i1) + "%");
i = l;
}
net.minecraft.util.ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
worldserver.theChunkProviderServer.loadChunk(chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4);
}
}
}
pluginManager.callEvent(new WorldLoadEvent(worldserver.getWorld()));
net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = false;
return worldserver.getWorld();
}
示例15: configureWorld
import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
public void configureWorld(WorldCreator worldCreator) {
worldCreator.generator(vanilla ? null : new NullChunkGenerator());
worldCreator.seed(seed);
}