本文整理汇总了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;
}
}
示例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) + ".");
}
示例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();
}
}
示例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;
}
示例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.");
}
示例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.");
}
示例7: broadcastDeveloperWarning
import org.bukkit.Bukkit; //导入方法依赖的package包/类
void broadcastDeveloperWarning(String message) {
logger.warning(message);
Bukkit.broadcast(ChatColor.RED + message, Permissions.MAPERRORS);
}
示例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);
}
示例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));
}
示例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);
}
}
示例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);
}
}