本文整理汇总了Java中org.bukkit.WorldCreator类的典型用法代码示例。如果您正苦于以下问题:Java WorldCreator类的具体用法?Java WorldCreator怎么用?Java WorldCreator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldCreator类属于org.bukkit包,在下文中一共展示了WorldCreator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWorld
import org.bukkit.WorldCreator; //导入依赖的package包/类
public World createWorld(ArcadeMap map) {
WorldCreator creator = new WorldCreator(map.getWorldName())
.environment(map.getEnvironment())
.generateStructures(false)
.generator(map.getGenerator().getChunkGenerator())
.hardcore(false)
.seed(map.getSeed())
.type(map.getGenerator().getWorldType());
World world = creator.createWorld();
world.setAutoSave(false);
world.setDifficulty(map.getDifficulty());
world.setKeepSpawnInMemory(false);
world.setPVP(map.isPvp());
world.setSpawnFlags(false, false);
world.setSpawnLocation(map.getSpawn().getBlockX(), map.getSpawn().getBlockY(), map.getSpawn().getBlockZ());
map.setWorld(world);
return world;
}
示例2: Minigame
import org.bukkit.WorldCreator; //导入依赖的package包/类
public Minigame() {
if (getLocation() != null) {
Bukkit.getServer().createWorld(new WorldCreator(getLocation().getWorld().getName()));
}
if (isAutoStart()) {
new BukkitRunnable() {
@Override
public void run() {
if (players.size() >= minPlayers) {
System.out.println("AutoJoin Timer");
start();
cancel();
}
}
}.runTaskTimer(SuperiorCraft.plugin, 10, 50);
}
Registry.registerListener(this);
minigames.add(this);
}
示例3: onEnable
import org.bukkit.WorldCreator; //导入依赖的package包/类
@Override
public void onEnable() {
world = Bukkit.createWorld(new WorldCreator(OpenUHC.WORLD_DIR_PREFIX + "lobby"));
// Read lobby yml if it exists
File lobbyFile = new File(OpenUHC.WORLD_DIR_PREFIX + "lobby/lobby.yml");
if (lobbyFile.exists()) {
FileConfiguration lobbyConfig = YamlConfiguration.loadConfiguration(lobbyFile);
ConfigurationSection spawn = lobbyConfig.getConfigurationSection("spawn");
if (spawn != null) {
double x = spawn.getDouble("x", 0);
double y = spawn.getDouble("y", 64);
double z = spawn.getDouble("z", 0);
double r = spawn.getDouble("r", 1);
this.spawn = new Vector(x, y, z);
radius = (float) r;
}
}
OpenUHC.registerEvents(this);
}
示例4: loadWorld
import org.bukkit.WorldCreator; //导入依赖的package包/类
public void loadWorld() {
new BukkitRunnable() {
@Override
public void run() {
Bukkit.createWorld(new WorldCreator(getWorldName()));
getWorld().setTime(6000 - (20 * 20));
for (Location l : getSpawns())
l.setWorld(getWorld());
getSpecSpawn().setWorld(getWorld());
for (Gamer g : Game.getTributes()) {
g.clearVariable("parkour");
g.setVariable("moveable", true);
Location next = getNextSpawn(g.getPlayer());
g.setVariable("spawn-block", next);
g.teleport(next);
g.setInvisible(false);
g.setVariable("moveable", false);
g.getPlayer().setHealth(20);
g.clearInventory();
g.clearScoreboard();
}
}
}.runTask(SurvivalGames.getInstance());
}
示例5: onCommand
import org.bukkit.WorldCreator; //导入依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player p = (Player) sender;
if (args.length != 1) {
Chat.player(sender, "&4[SG] &cPlease include the world name");
return true;
}
String name = args[0];
World w = Bukkit.getWorld(name);
if (w == null)
Bukkit.createWorld(new WorldCreator(name));
w = Bukkit.getWorld(name);
p.teleport(w.getSpawnLocation());
Chat.player(sender, "&2[SG] &aTeleported to " + w.getName() + " spawn point");
return true;
}
示例6: run
import org.bukkit.WorldCreator; //导入依赖的package包/类
@Override
public void run() {
Validate.notNull(map);
Cardinal.getPluginLogger().info("Cycling to map " + map.getName());
File dest = new File(Cardinal.getInstance().getDataFolder(), "matches/" + uuid.toString());
dest.mkdir();
try {
copyDirectory(map.getDirectory(), dest);
} catch (IOException ex) {
ex.printStackTrace();
}
Cardinal.getPluginLogger().info(dest.getPath());
World world = new WorldCreator(dest.getPath()).generator(new NullChunkGenerator()).createWorld();
world.setPVP(true);
this.world = world;
this.matchFile = dest;
}
示例7: 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();
}
}
示例8: setupWorld
import org.bukkit.WorldCreator; //导入依赖的package包/类
public Optional<World> setupWorld(Session session) {
if (session instanceof LobbySession) {
return Optional.of(Bukkit.getWorld(mainWorld));
}
if (session.getGame().isPresent()) {
Game game = session.getGame().get();
// Copy world from file
File file = new File(INST.getDataFolder().getPath() + "/worlds/" + game.getDirectory() + "/");
try {
FileUtils.copyDirectory(file, new File(session.getId()), true);
} catch (Exception oops) {
oops.printStackTrace();
}
// Load new world
Optional<World> world = Optional.ofNullable(new WorldCreator(session.getId()).createWorld());
if (world.isPresent()) {
world.get().setAutoSave(false);
}
return world;
}
return Optional.empty();
}
示例9: getBeaconzWorld
import org.bukkit.WorldCreator; //导入依赖的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;
}
示例10: 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;
}
示例11: onEnable
import org.bukkit.WorldCreator; //导入依赖的package包/类
public static void onEnable(){
Bukkit.getLogger().info("[CTF] Enabled :D");
ch.setupConfig();
Capture c = new Capture();
c.loop();
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getServer().getPluginManager().getPlugin("gFeatures"), new Runnable() {
public void run(){
WorldCreator cs = new WorldCreator("MinigameSpawn");
Bukkit.getServer().createWorld(cs);
WorldCreator cs1 = new WorldCreator("CTF");
Bukkit.getServer().createWorld(cs1);
CliotePing cp = new CliotePing();
cp.sendMessage("mghello", "Bungee");
}
}, 40L);
}
示例12: getWorld
import org.bukkit.WorldCreator; //导入依赖的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;
}
示例13: getSkyBlockNetherWorld
import org.bukkit.WorldCreator; //导入依赖的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;
}
示例14: 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;
}
示例15: getNetherWorld
import org.bukkit.WorldCreator; //导入依赖的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;
}