当前位置: 首页>>代码示例>>Java>>正文


Java WorldBorder.setSize方法代码示例

本文整理汇总了Java中org.bukkit.WorldBorder.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java WorldBorder.setSize方法的具体用法?Java WorldBorder.setSize怎么用?Java WorldBorder.setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.WorldBorder的用法示例。


在下文中一共展示了WorldBorder.setSize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEnable

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public void onEnable() {
	registerListeners();
	registerCommands();
	ConfigManager.getInstance().setup(this);

	WorldBorder b = Bukkit.getWorld("world").getWorldBorder();
	b.setCenter(new Location(Bukkit.getWorld("world"), 0, 64, 0));
	b.setSize(SettingsManager.border);
	
	BukkitScheduler scheduler = getServer().getScheduler();
	scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
		@Override
		public void run() {
			Bukkit.broadcastMessage("loop all players: :kappa:");
			if(GameManager.getGameSituation()) {
				if(GameManager.getStartTime() + 600000 > System.currentTimeMillis()) {
					b.setSize(b.getSize() - 1);
				}
			}
		}
	}, 0L, 1 * 20L);
}
 
开发者ID:masste,项目名称:McPlayUHC,代码行数:23,代码来源:McPlayUHC.java

示例2: BorderManagement

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public BorderManagement(int size, int decreaseSize, Location loc, int triggerTime){
    if(size<1 && decreaseSize>size){
        System.out.println("Wielkosc granicy musi byc >1");
        this.size = 1000;
        this.loc = loc;
        this.decreasedSize = 100;
        this.triggerTime = 60;
    }else{
        this.size = size;
        this.loc = loc;
        this.decreasedSize = decreaseSize;
        this.triggerTime = triggerTime;
    }

    WorldBorder wb = loc.getWorld().getWorldBorder();
    wb.setCenter(loc);
    wb.setDamageAmount(2);
    wb.setWarningTime(5);
    wb.setSize(size);
    wb.setWarningDistance(30);
}
 
开发者ID:grzegorz2047,项目名称:ExtremeSurvival,代码行数:22,代码来源:BorderManagement.java

示例3: run

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
@Override
public void run() {
    plugin.getServer().getOnlinePlayers().forEach(p ->
        Lang.sendMessage(p, "messages.game.shrinking")
    );
    times--;
    WorldBorder wb = battles.getWorld().getWorldBorder();
    double newSize = wb.getSize() - amount;
    if(newSize > 0) {
        wb.setSize(newSize, shrinkTime);
    }

    if(times <= 0) cancel();
}
 
开发者ID:DragonetMC,项目名称:PlayerStevesBattleGrounds,代码行数:15,代码来源:ShrinkBorderTask.java

示例4: onWorldLoad

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
@EventHandler
private void onWorldLoad(WorldLoadEvent e){
    e.getWorld().setAutoSave(false);
    WorldBorder b = e.getWorld().getWorldBorder();
    b.setCenter(0d, 0d);
    b.setSize(3000000d);
    plugin.getLogger().info(String.format("Auto-save for world [" + e.getWorld().getName() + "] is prevented! "));
}
 
开发者ID:DragonetMC,项目名称:PlayerStevesBattleGrounds,代码行数:9,代码来源:StaticWorldListener.java

示例5: execute

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
@Override
protected void execute(Event event) {
    World world = worldExpression.getSingle(event);
    WorldBorder border = world.getWorldBorder();
    double value = numberExpression.getSingle(event).doubleValue();
    long seconds = timespanExpression.getSingle(event).getMilliSeconds() / 1000;
    switch (changeMode) {
        case SET: border.setSize(value, seconds); break;
        case ADD: border.setSize(border.getSize() + value, seconds); break;
        case REMOVE: border.setSize(border.getSize() - value, seconds); break;
    }
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:13,代码来源:EffChangeBorderDiameter.java

示例6: setProperty

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public static void setProperty(WorldBorder border, BorderProperty borderProperty, Number value) {
    switch (borderProperty) {
        case DIAMETER: border.setSize(value.doubleValue()); return;
        case DAMAGE_AMOUNT: border.setDamageAmount(value.doubleValue()); return;
        case DAMAGE_BUFFER: border.setDamageBuffer(value.doubleValue()); return;
        case WARNING_DISTANCE: border.setWarningDistance(value.intValue()); return;
        case WARNING_TIME: border.setWarningTime(value.intValue()); return;
    }
    throw new IllegalArgumentException("Illegal BorderProperty: " + borderProperty);
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:11,代码来源:ExprPropertyOfBorder.java

示例7: resetProperty

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public static void resetProperty(WorldBorder border, BorderProperty borderProperty) {
    switch (borderProperty) {
        case DIAMETER: border.setSize(60000000); return;
        case DAMAGE_AMOUNT: border.setDamageAmount(0.2); return;
        case DAMAGE_BUFFER: border.setDamageBuffer(5); return;
        case WARNING_DISTANCE: border.setWarningDistance(5); return;
        case WARNING_TIME: border.setWarningTime(15); return;
    }
    throw new IllegalArgumentException("Illegal BorderProperty: " + borderProperty);
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:11,代码来源:ExprPropertyOfBorder.java

示例8: onMatchCreate

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
@EventHandler
public void onMatchCreate(MatchCreateEvent event) {
    GameMap map = event.getMatch().getMap();
    if (map.getWorldBorder().isEnabled()) {
        WorldBorder wb = event.getMatch().getWorld().getWorldBorder();
        wb.setCenter(map.getWorldBorder().getCenterX(), map.getWorldBorder().getCenterY());
        wb.setSize(map.getWorldBorder().getRadius()*2);
    }
}
 
开发者ID:redwallhp,项目名称:AthenaGM,代码行数:10,代码来源:WorldBorderModule.java

示例9: resetBorder

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public void resetBorder(){
    WorldBorder wb = this.loc.getWorld().getWorldBorder();
    wb.setCenter(this.loc);
    wb.setDamageAmount(2);
    wb.setWarningTime(5);
    wb.setSize(this.size);
    wb.setWarningDistance(30);
}
 
开发者ID:grzegorz2047,项目名称:ExtremeSurvival,代码行数:9,代码来源:BorderManagement.java

示例10: start

import org.bukkit.WorldBorder; //导入方法依赖的package包/类
public void start() {
    if (!isValid()) return;

    state = ArenaState.ACTIVE;
    started = System.currentTimeMillis();
    lastTick = started;

    if (startCommands != null && !startCommands.isEmpty()) {
        String[] commands = StringUtils.split(startCommands, ',');
        CommandSender sender = Bukkit.getConsoleSender();
        for (String command : commands) {
            org.bukkit.Bukkit.getLogger().info("RUNNING: " + command);
            controller.getPlugin().getServer().dispatchCommand(sender, command);
        }
    }
    if (borderMax > 0 && duration > 0) {
        World world = getCenter().getWorld();
        WorldBorder border = world.getWorldBorder();
        border.setSize(borderMax);
        border.setSize(borderMin, duration / 1000);
    }

    int num = 0;
    clearPlayers();
    while (queue.size() > 0 && players.size() < maxPlayers) {
        ArenaPlayer queuedPlayer = queue.remove();
        if (queuedPlayer.isValid() && !queuedPlayer.isDead()) {
            players.add(queuedPlayer);
        }
    }
    if (players.size() < minPlayers) {
        queue.addAll(players);
        players.clear();
        state = ArenaState.LOBBY;
        messagePlayers(ChatColor.RED + " the match did not have enough players to start.");
        return;
    }
    List<Location> spawns = getSpawns();
    for (ArenaPlayer arenaPlayer : players) {
        Player player = arenaPlayer.getPlayer();
        if (player == null) {
            continue;
        }

        arenaPlayer.heal();
        player.sendMessage(ChatColor.GOLD + "BEGIN!");

        Location spawn = spawns.get(num);
        if (randomizeSpawn != null) {
            spawn = spawn.clone();
            spawn.add
            (
                (2 * random.nextDouble() - 1) * randomizeSpawn.getX(),
                (2 * random.nextDouble() - 1) * randomizeSpawn.getY(),
                (2 * random.nextDouble() - 1) * randomizeSpawn.getZ()
            );
        }

        // Wrap index around to player
        num = (num + 1) % spawns.size();
        arenaPlayer.teleport(spawn);
    }

    ArenaStage currentStage = getCurrentStage();
    if (currentStage != null) {
        currentStage.start();
    }

    messageNextRoundPlayerList(ChatColor.GOLD + "You are up for the next round!");
}
 
开发者ID:elBukkit,项目名称:MagicArenas,代码行数:71,代码来源:Arena.java


注:本文中的org.bukkit.WorldBorder.setSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。