當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldCreator.generateStructures方法代碼示例

本文整理匯總了Java中org.bukkit.WorldCreator.generateStructures方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldCreator.generateStructures方法的具體用法?Java WorldCreator.generateStructures怎麽用?Java WorldCreator.generateStructures使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.WorldCreator的用法示例。


在下文中一共展示了WorldCreator.generateStructures方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createArenaWorld

import org.bukkit.WorldCreator; //導入方法依賴的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;
}
 
開發者ID:netizen539,項目名稱:civcraft,代碼行數:19,代碼來源:ArenaManager.java

示例2: 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);
}
 
開發者ID:SkyWars,項目名稱:SkyWars,代碼行數:23,代碼來源:SkyWorldHandler.java

示例3: 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);
}
 
開發者ID:VoxelGamesLib,項目名稱:VoxelGamesLib,代碼行數:12,代碼來源:BukkitWorldHandler.java

示例4: createWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public void createWorld() {
    if (!name.isPresent()) {
        throw new UnsupportedOperationException("You must supply a name if you want to create a world using a nameless creator: " + this);
    }
    WorldCreator creator = new WorldCreator(name.get());
    creator.environment(dimension.toEnvironment());
    creator.type(type);
    creator.seed(seed.orElseGet(() -> new Random().nextLong()));
    generator.ifPresent(creator::generator);
    creator.generatorSettings(generatorSettings);
    creator.generateStructures(structures);
    creator.createWorld();
}
 
開發者ID:MundoSK,項目名稱:MundoSK,代碼行數:14,代碼來源:WorldCreatorData.java

示例5: loadWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public World loadWorld()
{
  WorldCreator c = new WorldCreator(name);
  c.generateStructures(false);
  World localWorld = c.createWorld();
  localWorld.setAutoSave(false);
  localWorld.setKeepSpawnInMemory(false);
  localWorld.setGameRuleValue("doMobSpawning", "false");
  localWorld.setGameRuleValue("doDaylightCycle", "false");
  localWorld.setGameRuleValue("mobGriefing", "false");
  localWorld.setTime(0L);
  return localWorld;
}
 
開發者ID:SpikyBite,項目名稱:BiteSkywars,代碼行數:14,代碼來源:Arena.java

示例6: 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();
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:16,代碼來源:WorldManager.java

示例7: 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();
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:13,代碼來源:WorldManager.java

示例8: create_cmd

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public void create_cmd() throws CivException {
	String name = getNamedString(1, "enter a world name");
	
	WorldCreator wc = new WorldCreator(name);
	wc.environment(Environment.NORMAL);
	wc.type(WorldType.FLAT);
	wc.generateStructures(false);
	
	World world = Bukkit.getServer().createWorld(wc);
	world.setSpawnFlags(false, false);
	ChunkCoord.addWorld(world);
	
	CivMessage.sendSuccess(sender, "World "+name+" created.");
	
}
 
開發者ID:netizen539,項目名稱:civcraft,代碼行數:16,代碼來源:DebugWorldCommand.java

示例9: getWorldCreator

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public WorldCreator getWorldCreator(String name) {

        WorldCreator worldCreator = new WorldCreator(name);
        worldCreator.environment(environment);
        worldCreator.generateStructures(generateStructures);
        worldCreator.type(worldType);
        // worldCreator.seed(randomSeed());

        return worldCreator;
    }
 
開發者ID:Relicum,項目名稱:Ipsum,代碼行數:11,代碼來源:WorldMaker.java

示例10: 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;
}
 
開發者ID:Yoshi41023,項目名稱:TatsuCraftMod,代碼行數:39,代碼來源:TFM_Flatlands.java

示例11: 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();
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:56,代碼來源:CraftServer.java

示例12: onCommand

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command arg1,
		String arg2, String[] args) {

	Object[] params = {"", 
					   String.valueOf(new Random().nextLong()), 
					   WorldType.NORMAL, 
					   Environment.NORMAL,
					   true};
	
	if(args.length > 0){
		if(args.length > params.length){
			sender.sendMessage(ChatColor.RED + "Too many arguments were provided!");
		} else {
			for(int index = (args.length - 1); index > -1; index--){
				Object obj = getParameters().get(index).getParameterValue(args[index]);
				if(obj != null){
					params[index] = obj;
				} else {
					sender.sendMessage(ChatColor.RED + "Invalid parameter supplied at index " + index);
					return false;
				}
			}
		
            if(!WorldManagerHelper.isWorldFolder(new File(Bukkit.getWorldContainer(), (String) params[0]))){
            	
                WorldCreator creator = new WorldCreator((String) params[0]);
                
                String seedStr = (String) params[1];
                long seed = seedStr.hashCode();
                try {
                	seed = Long.valueOf(seedStr);
                } catch (NumberFormatException e){}
             
                creator.seed(seed);
                creator.type((WorldType) params[2]);
                creator.environment((Environment) params[3]);
                creator.generateStructures((boolean) params[4]);

                sender.sendMessage("Generating world");
                creator.createWorld().save();
                //Bukkit.getLogger().info("Generator String: " + creator.generatorSettings());
                sender.sendMessage("Done generating world");
                return true;
            } else {
            	sender.sendMessage(ChatColor.RED + "That world already exists. You must delete the world before creating a new world with the same name!");
            }
		}
	} else {
		sender.sendMessage(ChatColor.RED + "You must provide at least a world name");
	}
       
       return false;
}
 
開發者ID:robotman3000,項目名稱:Spigot-Plus,代碼行數:55,代碼來源:WorldCreateCommand.java

示例13: createNew

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
/**
 * Create a New World
 *
 * @param wname         the name of the world as a {@link java.lang.String}
 * @param worldType     the world type {@link org.bukkit.WorldType}
 * @param environment   the world {@link org.bukkit.World.Environment}
 * @param genStructures {@link java.lang.Boolean} true to generate
 *                      structures
 * @param genSettings   the generator settings as a {@link java.lang.String}
 * @param theSeed       the seed for the world
 * @return the newly created {@link org.bukkit.World}
 */
public World createNew(String wname, WorldType worldType, World.Environment environment, boolean genStructures, String genSettings, long theSeed) {

    WorldCreator wc = getCreator(wname);
    wc.type(worldType);
    wc.environment(environment);
    wc.generateStructures(genStructures);
    wc.generator(genSettings);
    wc.seed(theSeed);

    return wc.createWorld();
}
 
開發者ID:Relicum,項目名稱:SuperSkyBros,代碼行數:24,代碼來源:WManager.java


注:本文中的org.bukkit.WorldCreator.generateStructures方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。