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


Java Bukkit.broadcastMessage方法代码示例

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


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

示例1: call

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void call(Event event) {
	if (event instanceof PlayerInteractEvent) {
		final PlayerInteractEvent pie = (PlayerInteractEvent) event;

		// Types of interacting where the arm must swing.
		if (pie.getAction() == Action.LEFT_CLICK_AIR || pie.getAction() == Action.LEFT_CLICK_BLOCK) {
			lastInteract = System.currentTimeMillis();
		}
	} else if (event instanceof PlayerAnimationEvent) {
		final PlayerAnimationEvent pae = (PlayerAnimationEvent) event;

		if (pae.getAnimationType() == PlayerAnimationType.ARM_SWING) {
			final long difference = System.currentTimeMillis() - lastInteract;

			Bukkit.broadcastMessage("swing difference: " + difference);
		}
	}
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:20,代码来源:NoSwingA.java

示例2: handlePlayerJoin

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void handlePlayerJoin( FlexPlayer player ) {
    this.players.put( player.getUuid(), player );
    List<MessageS2EPlayerList.PlayerItem> items = new ArrayList<>();
    for ( FlexPlayer target : this.getOnlinePlayers() ) {
        if( !target.equals( player ) ) {
            target.getConnectionHandler().sendMessage( new MessageS2EPlayerList( MessageS2EPlayerList.Action.ADD_PLAYER,
                    Collections.singletonList( new MessageS2EPlayerList.PlayerItem().setUuid( player.getUuid() ).setName( player.getName() ).setGameMode( player.getGameMode() ).setPing( player.getLatency() ) ) ) );
        }
        items.add( new MessageS2EPlayerList.PlayerItem().setName( target.getName() ).setUuid( target.getUuid() ).setGameMode( target.getGameMode() ).setPing( target.getLatency() ) );
    }
    player.getConnectionHandler().sendMessage( new MessageS2EPlayerList( MessageS2EPlayerList.Action.ADD_PLAYER, items ) );
    System.out.println( player.getName() + " (" + player.getUuid().toString() + ") logged in from " + player.getIpAddress() );
    player.spawnPlayer();
    player.getWorld().addEntity( player, true );

    String joinMessage = EventFactory.call( new PlayerJoinEvent( player, "§e" + player.getName() + " joined the game." ) ).getJoinMessage();
    if( joinMessage != null && !joinMessage.isEmpty() ) {
        Bukkit.broadcastMessage( joinMessage );
    }

}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:22,代码来源:PlayerManager.java

示例3: handleWinner

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Handles the winner for this event.
 *
 * @param winner
 *            the {@link Player} that won
 */
public void handleWinner(Player winner) {
    if (this.eventFaction == null)
        return;

    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(winner);
    Bukkit.broadcastMessage(ChatColor.GOLD + "[" + "WIN" + "] " + ChatColor.RED + winner.getName() + ChatColor.AQUA
            + ChatColor.YELLOW + " has captured " + ChatColor.RED + this.eventFaction.getName()
            + ChatColor.YELLOW + " after " + ChatColor.RED + DurationFormatUtils.formatDurationWords(getUptime(), true, true) + " of up-time" + ChatColor.YELLOW + '.');

    EventType eventType = this.eventFaction.getEventType();
    World world = winner.getWorld();
    Location location = winner.getLocation();
    EventKey eventKey = plugin.getKeyManager().getEventKey();
    Collection<Inventory> inventories = eventKey.getInventories(eventType);
    ItemStack keyStack = eventKey.getItemStack(new EventKey.EventKeyData(eventType, inventories.isEmpty() ? 1 : plugin.getRandom().nextInt(inventories.size()) + 1));
    Map<Integer, ItemStack> excess = winner.getInventory().addItem(keyStack, EventSignListener.getEventSign(eventFaction.getName(), winner.getName()));
    for (ItemStack entry : excess.values()) {
        world.dropItemNaturally(location, entry);
    }

    this.clearCooldown(); // must always be cooled last as this nulls some variables.
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:29,代码来源:EventTimer.java

示例4: onMatchEnd

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW)
public void onMatchEnd(MatchEndEvent event) {
    Match match = event.getMatch();
    Tourney plugin = Tourney.get();
    this.session.appendMatch(match, plugin.getMatchManager().getTeamManager().teamToEntrant(Iterables.getOnlyElement(event.getMatch().needMatchModule(VictoryMatchModule.class).winners(), null)));

    Entrant winningParticipation = this.session.calculateWinner();
    int matchesPlayed = this.session.getMatchesPlayed();
    if (winningParticipation != null) {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has been determined!");
        Bukkit.broadcastMessage(ChatColor.AQUA + WordUtils.capitalize(winningParticipation.team().name()) + ChatColor.RESET + ChatColor.YELLOW + " wins! Congratulations!");
        plugin.clearKDMSession();
    } else if (matchesPlayed < 3) {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has not yet been determined! Beginning match #" + (matchesPlayed + 1) + "...");
        match.needMatchModule(CycleMatchModule.class).startCountdown(Duration.ofSeconds(15), session.getMap());
    } else {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "There is a tie! Congratulations to both teams!");
        Tourney.get().clearKDMSession();
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:21,代码来源:KDMListener.java

示例5: tick

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void tick(EventTimer eventTimer, EventFaction eventFaction) {
    CaptureZone captureZone = ((KothFaction) eventFaction).getCaptureZone();
    captureZone.updateScoreboardRemaining();
    long remainingMillis = captureZone.getRemainingCaptureMillis();
    if (remainingMillis <= 0L) { // has been captured.
        plugin.getTimerManager().getEventTimer().handleWinner(captureZone.getCappingPlayer());
        eventTimer.clearCooldown();
        return;
    }

    if (remainingMillis == captureZone.getDefaultCaptureMillis())
        return;

    int remainingSeconds = (int) (remainingMillis / 1000L);
    if (remainingSeconds > 0 && remainingSeconds % 30 == 0) {
        Bukkit.broadcastMessage(ChatColor.GOLD + "[" + eventFaction.getEventType().getDisplayName() + "] " + ChatColor.YELLOW + "Someone is controlling " + ChatColor.RED
                + captureZone.getDisplayName() + ChatColor.YELLOW + ". " + ChatColor.RED + '(' + DateTimeFormats.KOTH_FORMAT.format(remainingMillis) + ')');
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:21,代码来源:KothTracker.java

示例6: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    EventTimer eventTimer = plugin.getTimerManager().getEventTimer();
    Faction eventFaction = eventTimer.getEventFaction();

    if (!eventTimer.clearCooldown()) {
        sender.sendMessage(ChatColor.RED + "There is not a running event.");
        return true;
    }

    Bukkit.broadcastMessage(sender.getName() + ChatColor.YELLOW + " has cancelled " + (eventFaction == null ? "the active event" : eventFaction.getName() + ChatColor.YELLOW) + ".");
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:14,代码来源:EventCancelArgument.java

示例7: run

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void run() {
	Game game = Chambers.getInstance().getGameManager().getGame();
	game.setCountdownTime(game.getCountdownTime() - 1);
	if (game.getCountdownTime() == 0) {
		Chambers.getInstance().getGameManager().finallyStart();
		cancel();
	} else if (game.getCountdownTime() % 5 == 0 || game.getCountdownTime() <= 5) {
		Bukkit.broadcastMessage(ChatColor.YELLOW + "Game starting in " + ChatColor.GREEN + game.getCountdownTime() + ChatColor.YELLOW + (game.getCountdownTime() == 1 ? " second" : " seconds") + ".");
	}
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:12,代码来源:CountdownTask.java

示例8: onControlLoss

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void onControlLoss(Player player, CaptureZone captureZone, EventFaction eventFaction) {
    player.sendMessage(ChatColor.RED + "You are no longer in control of " + ChatColor.RED + captureZone.getDisplayName() + ChatColor.DARK_AQUA + '.');

    // Only broadcast if the KOTH has been controlled for at least 25 seconds to prevent spam.
    long remainingMillis = captureZone.getRemainingCaptureMillis();
    if (remainingMillis > 0L && captureZone.getDefaultCaptureMillis() - remainingMillis > MINIMUM_CONTROL_TIME_ANNOUNCE) {
        Bukkit.broadcastMessage(ChatColor.GOLD + "[" + eventFaction.getEventType().getDisplayName() + "] " + ChatColor.RED + captureZone.getDisplayName() + ChatColor.YELLOW + " has been knocked!"
                + " (" + captureZone.getScoreboardRemaining() + ')');
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:12,代码来源:KothTracker.java

示例9: execute

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void execute() {
	String message = "";
	for (String part : getArgs()) {
		if (message != "")
			message += " ";
		message += part;
	}
	Bukkit.broadcastMessage(ChatColor.BLACK + "[" + ChatColor.DARK_RED +"BROADCAST" + ChatColor.BLACK + "] " + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', message));
	broadcast(PlayerModule.getInstance().getPlayer(getSender()).getFormattedName() + ChatColor.YELLOW + " broadcasted: " + message);
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:12,代码来源:BroadcastCommand.java

示例10: onCraftItem

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Checks if a player has crafted an item for the first time and announces it if this is the case.
 *
 * @param event The event
 */
@EventHandler(ignoreCancelled = true)
public void onCraftItem(CraftItemEvent event) {
  Material type = event.getRecipe().getResult().getType();
  if (!invented.contains(type)) {
    invented.add(type);
    Bukkit.broadcastMessage(
        event.getWhoClicked().getName() + ChatColor.GRAY + " has invented the " + ChatColor.AQUA + type.name()
    );
  }
}
 
开发者ID:twizmwazin,项目名称:OpenUHC,代码行数:16,代码来源:Inventors.java

示例11: start

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Starts the Game
 */
public void start() {
	game.setStatus(GameStatus.STARTING);
	Bukkit.getOnlinePlayers().stream().forEach(player -> player.getInventory().clear());
	new CountdownTask().runTaskTimerAsynchronously(Chambers.getInstance(), 0L, 20L);
	Bukkit.broadcastMessage(ChatColor.YELLOW + "The countdown is now starting");
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:10,代码来源:GameManager.java

示例12: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
	if(!hasPerm(sender, Permissions.BRODCAST)) {
		sender.sendMessage(NPP);
		return true;
	}
	
	if(args.length == 0) Bukkit.broadcastMessage(prefix);
	
	String s = StringUtils.join(args, " ");
	Bukkit.broadcastMessage(prefix + trans(s));
	return true;
}
 
开发者ID:ramidzkh,项目名称:Bssentials-Reloaded,代码行数:14,代码来源:Brodcast.java

示例13: DownloadAntiAttack

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void DownloadAntiAttack() {
    if (Bukkit.getPluginManager().getPlugin("AntiAttack") != null) {
        Bukkit.broadcastMessage("§a§l[EscapeLag]§c错误!您的服务器已经安装了AntiAttack反压测模块!无需再次安装!");
        return;
    }
    try {
        File AntiAttackFile = new File("/plugins", "AntiAttack.jar");
        DowloadFile("https://www.relatev.com/files/AntiAttack/AntiAttack.jar", AntiAttackFile);
        Bukkit.broadcastMessage("§a§l[EscapeLag]§b成功下载了AntiAttack反压测插件,重启即可生效!");
    } catch (IOException ex) {
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:13,代码来源:NetWorker.java

示例14: d

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Inject(InjectionType.INSERT)
private boolean d(DamageSource src) {
    Bukkit.broadcastMessage("Checked " + this.getName() + " for totem @ " + (int) this.locX + ", " + (int) this.locY + ", " + (int) this.locZ + "!");
    throw null; // Let original method continue execution
}
 
开发者ID:Yamakaja,项目名称:RuntimeTransformer,代码行数:6,代码来源:EntityLivingTransformer.java

示例15: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args.length < 3) {
        sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
        return true;
    }

    Faction faction = plugin.getFactionManager().getFaction(args[1]);

    if (faction == null || !(faction instanceof KothFaction)) {
        sender.sendMessage(ChatColor.RED + "There is not a KOTH arena named '" + args[1] + "'.");
        return true;
    }

    long duration = JavaUtils.parse(StringUtils.join(args, ' ', 2, args.length));

    if (duration == -1L) {
        sender.sendMessage(ChatColor.RED + "Invalid duration, use the correct format: 10m 1s");
        return true;
    }

    KothFaction kothFaction = (KothFaction) faction;
    CaptureZone captureZone = kothFaction.getCaptureZone();

    if (captureZone == null) {
        sender.sendMessage(ChatColor.RED + kothFaction.getDisplayName(sender) + ChatColor.RED + " does not have a capture zone.");
        return true;
    }

    // Update the remaining time if it is less.
    if (captureZone.isActive() && duration < captureZone.getRemainingCaptureMillis()) {
        captureZone.setRemainingCaptureMillis(duration);
    }

    captureZone.setDefaultCaptureMillis(duration);
    sender.sendMessage(ChatColor.YELLOW + "Set the capture delay of KOTH arena " + ChatColor.WHITE + kothFaction.getDisplayName(sender) + ChatColor.YELLOW + " to " + ChatColor.WHITE
            + DurationFormatUtils.formatDurationWords(duration, true, true) + ChatColor.WHITE + '.');
    Bukkit.broadcastMessage(ChatColor.YELLOW + "The capture time of " + ChatColor.RED + kothFaction.getDisplayName(sender) + ChatColor.YELLOW + " has been set to " + ChatColor.RED
            + DurationFormatUtils.formatDurationWords(duration, true, true) + ChatColor.YELLOW + '.');

    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:43,代码来源:KothSetCapDelayArgument.java


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