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


Java Bukkit.broadcast方法代码示例

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


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

示例1: cycleTo

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private @Nullable Match cycleTo(@Nullable Match oldMatch, PGMMap map) {
    try {
        mapErrorTracker.clearErrors(map);

        if(map.shouldReload()) {
            Bukkit.broadcast(ChatColor.GREEN + "XML changes detected, reloading", Permissions.MAPERRORS);
            mapLoader.loadMap(map);
            mapLibrary.pushDirtyMaps();
        }

        return matchLoader.cycleTo(oldMatch, map);
    } catch(MapNotFoundException e) {
        // Maps are sometimes removed, must handle it gracefully
        log.warning("Skipping deleted map " + map.getName());
        try {
            loadMapsAndRotations();
        } catch(MapNotFoundException e2) {
            log.severe("No maps could be loaded, server cannot cycle");
        }
        return null;
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:23,代码来源:MatchManager.java

示例2: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Command(name = "game.setcountdown", description = "Set the countdown time of the game", aliases = { "managegame.setcountdown" }, usage = "/<command> <args>", requiresTeam = false, adminsOnly = true)
public void onCommand(CommandArgs commandArgs) {
    Game game = plugin.getGameManager().getGame();
    if (commandArgs.length() != 1) {
        commandArgs.getSender().sendMessage(ChatColor.RED + "Usage: /" + commandArgs.getLabel() + " <time>");
        return;
    }
    if (game.getStatus() != GameStatus.STARTING) {
        commandArgs.getPlayer().sendMessage(ChatColor.RED + "The countdown has already started.");
        return;
    }
    if (!MathUtil.isInt(commandArgs.getArgs(0))) {
        commandArgs.getSender().sendMessage(ChatColor.RED + "Please enter a valid integer.");
        return;
    }
    int time = Math.abs(Integer.valueOf(commandArgs.getArgs(1)));
    if (time == 0 || time > 120) {
        commandArgs.getSender().sendMessage(ChatColor.RED + "Please enter a time less than 120 and greater than 0.");
    }
    game.setCountdownTime(time);
    Bukkit.broadcast("chambers.staff", ChatColor.GREEN + commandArgs.getSender().getName() + ChatColor.YELLOW + " has set the countdown time to " + commandArgs.getArgs(1) + ".");
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:23,代码来源:GameSetCountdownCommand.java

示例3: publish

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record) {
    Bukkit.broadcast(formatMessage(record), permission);

    if(Bukkit.getConsoleSender().hasPermission(permission) &&
       record.getThrown() != null &&
       !(record instanceof ChatLogRecord && ((ChatLogRecord) record).suppressStackTrace())) {

        record.getThrown().printStackTrace();
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:12,代码来源:ChatLogHandler.java

示例4: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
  if (args.length < 1)
  {
    sender.sendMessage(ChatColor.RED + "Usage: " + "/rawcast");
    return true;
  }
  String arg;
  String requiredNode;
  int position = 0;
  if ((args.length > 2) && ((arg = args[0]).startsWith("-p")))
  {
    int position1 = 1;
    requiredNode = arg.substring(2, arg.length());
  }
  else
  {
    position = 0;
    requiredNode = null;
  }
  String message = StringUtils.join(args, ' ', position, args.length);
  if (message.length() < 3)
  {
    sender.sendMessage(ChatColor.RED + "Broadcasts must be at least 3 characters.");
    return true;
  }
  message = ChatColor.translateAlternateColorCodes('&', message);
  if (requiredNode != null) {
    Bukkit.broadcast(message, requiredNode);
  } else {
    Bukkit.broadcastMessage(message);
  }
  return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:35,代码来源:RawcastCommand.java

示例5: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Command(name = "game.stop", description = "Stop the game", aliases = { "managegame.stop" }, usage = "/<command> <args>", requiresTeam = false, adminsOnly = true)
public void onCommand(CommandArgs commandArgs) {
    Game game = plugin.getGameManager().getGame();
    if (!game.hasStarted()) {
        commandArgs.getPlayer().sendMessage(ChatColor.RED + "The game has not started yet.");
        return;
    }
    Team team = null;
    if (commandArgs.length() == 1) {
        team = plugin.getTeamManager().getTeamByName(commandArgs.getArgs(0));
    }
    plugin.getGameManager().stop(team);
    Bukkit.broadcast("chambers.staff", ChatColor.GREEN + commandArgs.getSender().getName() + ChatColor.YELLOW + " has forcefully stopped the game.");
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:15,代码来源:GameStopCommand.java

示例6: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Command(name = "game.start", description = "Start the game", aliases = { "managegame.start" }, usage = "/<command>", requiresTeam = false, adminsOnly = true)
public void onCommand(CommandArgs commandArgs) {
    Game game = plugin.getGameManager().getGame();
    if (game.hasStarted()) {
        commandArgs.getPlayer().sendMessage(ChatColor.RED + "The game has already started.");
        return;
    }
    plugin.getGameManager().start();
    Bukkit.broadcast("chambers.staff", ChatColor.GREEN + commandArgs.getSender().getName() + ChatColor.YELLOW + " has forcefully started the countdown.");
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:11,代码来源:GameStartCommand.java

示例7: broadcastDeveloperWarning

import org.bukkit.Bukkit; //导入方法依赖的package包/类
void broadcastDeveloperWarning(String message) {
    logger.warning(message);
    Bukkit.broadcast(ChatColor.RED + message, Permissions.MAPERRORS);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:WorldProblemMatchModule.java

示例8: scheduleBan

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Schedule a ban.
 *
 * @param player the player.
 */
public void scheduleBan(Player player) {

    UUID uuid = player.getUniqueId();
    String name = player.getName();

    if (BAN_QUEUE.contains(uuid)) {
        return;
    }

    // add and broadcast.
    BAN_QUEUE.add(uuid);
    int time = Arc.getArcConfiguration().getBanTime();

    Bukkit.broadcast(ChatColor.DARK_GRAY + "[" + ChatColor.RED + "Arc" + ChatColor.DARK_GRAY + "] " + ChatColor.BLUE
            + player.getName() + ChatColor.WHITE + " is scheduled to be banned in " + ChatColor.RED + time
            + ChatColor.WHITE + " seconds.", "arc.notify");

    long timeScheduled = System.currentTimeMillis();

    new BukkitRunnable() {
        @Override
        public void run() {
            if (!BAN_QUEUE.contains(uuid)) {
                this.cancel();
            }
            if (System.currentTimeMillis() - timeScheduled >= time * 1000) {
                if (BAN_QUEUE.contains(uuid)) {
                    // get the ban data and ban the player.
                    String reason = ChatColor.RED + "You have been banned for cheating.";

                    Date date = Arc.getArcConfiguration().getBanDate();
                    BanList.Type type = Arc.getArcConfiguration().getBanType();
                    Bukkit.getBanList(type).addBan(name, reason, date, null);

                    if (Arc.getArcConfiguration().shouldBroadcastBan()) {
                        String message = Arc.getArcConfiguration().getBroadcastMessage().replace("%player%", player.getName());
                        Bukkit.broadcastMessage(message);
                    }

                    if (player.isOnline()) {
                        player.kickPlayer(reason);
                    }

                    // remove the player.
                    BAN_QUEUE.remove(uuid);
                }
            }
        }
    }.runTaskTimer(Arc.getPlugin(), 0, 20);

}
 
开发者ID:Vrekt,项目名称:Arc-v2,代码行数:57,代码来源:ArcPlayerManager.java

示例9: broadcast

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Broadcast a text component to in-game and discord.
 * @param baseComponents
 */
public static void broadcast(BaseComponent... baseComponents) {
    Bukkit.getConsoleSender().sendMessage(TextUtils.toLegacy(baseComponents));
    Bukkit.broadcast(baseComponents);
    DiscordAPI.sendGame(TextUtils.toLegacy(baseComponents));
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:10,代码来源:Core.java

示例10: broadcastJoinMessage

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void broadcastJoinMessage(String permission, PlayerJoinEvent event) {
	event.setJoinMessage(null);
	for (String x : joinmessage) {
		Bukkit.broadcast(Main.colorcode(x), permission);
	}
}
 
开发者ID:RcExtract,项目名称:ChatAssets,代码行数:7,代码来源:LogHandler.java

示例11: broadcastQuitMessage

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void broadcastQuitMessage(String permission, PlayerQuitEvent event) {
	event.setQuitMessage(null);
	for (String x : quitmessage) {
		Bukkit.broadcast(x, permission);
	}
}
 
开发者ID:RcExtract,项目名称:ChatAssets,代码行数:7,代码来源:LogHandler.java


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