org.bukkit.Bukkit#broadcast ( )源码实例Demo

下面列出了org.bukkit.Bukkit#broadcast ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ProjectAres   文件: MatchManager.java
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 项目: PGM   文件: PGMPlugin.java
@Override
public void publish(LogRecord record) {
  final String message = format(record);

  if (message != null) {
    getLogger().log(Level.INFO, ChatColor.stripColor(message));
    Bukkit.broadcast(message, Permissions.DEBUG);
  }

  if (message == null || message.contains("Unhandled")) {
    getLogger()
        .log(record.getLevel(), record.getThrown().getMessage(), record.getThrown().getCause());
  }
}
 
源代码3 项目: ProjectAres   文件: ChatLogHandler.java
@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 项目: skUtilities   文件: UpdateChecker.java
private void prSysU(String s) {
    if (broadcastUpdates) {
        String message = ChatColor.AQUA + "[" + plugin.getName() + ": Update] " + ChatColor.GRAY + s;
        Bukkit.broadcast(message, plugin.getName() + ".update");
    }
    skUtilities.prSysI(s);
}
 
源代码5 项目: CloudNet   文件: CloudServer.java
private void addTeamEntry(Player target, Player all, PermissionGroup permissionGroup) {
    String teamName = permissionGroup.getTagId() + permissionGroup.getName();
    if (teamName.length() > 16) {
        teamName = teamName.substring(0, 16);
        CloudAPI.getInstance()
                .dispatchConsoleMessage("In order to prevent issues, the name (+ tagID) of the group " + permissionGroup.getName() + " was temporarily shortened to 16 characters!");
        CloudAPI.getInstance().dispatchConsoleMessage("Please fix this issue by changing the name of the group in your perms.yml");
        Bukkit.broadcast("In order to prevent issues, the name (+ tagID) of the group " + permissionGroup.getName() + " was temporarily shortened to 16 characters!",
                         "cloudnet.notify");
        Bukkit.broadcast("Please fix this issue by changing the name of the group in your perms.yml", "cloudnet.notify");
    }
    Team team = all.getScoreboard().getTeam(teamName);
    if (team == null) {
        team = all.getScoreboard().registerNewTeam(teamName);
    }

    if (permissionGroup.getPrefix().length() > 16) {
        permissionGroup.setPrefix(permissionGroup.getPrefix().substring(0, 16));
        CloudAPI.getInstance()
                .dispatchConsoleMessage("In order to prevent issues, the prefix of the group " + permissionGroup.getName() + " was temporarily shortened to 16 characters!");
        CloudAPI.getInstance().dispatchConsoleMessage("Please fix this issue by changing the prefix in your perms.yml");
        Bukkit.broadcast("In order to prevent issues, the prefix of the group " + permissionGroup.getName() + " was temporarily shortened to 16 characters!",
                         "cloudnet.notify");
        Bukkit.broadcast("Please fix this issue by changing the prefix in your perms.yml", "cloudnet.notify");
    }
    if (permissionGroup.getSuffix().length() > 16) {
        permissionGroup.setSuffix(permissionGroup.getSuffix().substring(0, 16));
        CloudAPI.getInstance()
                .dispatchConsoleMessage("In order to prevent issues, the suffix of the group " + permissionGroup.getName() + " was temporarily shortened to 16 characters!");
        CloudAPI.getInstance().dispatchConsoleMessage("Please fix this issue by changing the suffix in your perms.yml");
        Bukkit.broadcast("In order to prevent issues, the suffix of the group " + permissionGroup.getName() + " was temporarily shortened to 16 characters!",
                         "cloudnet.notify");
        Bukkit.broadcast("Please fix this issue by changing the suffix in your perms.yml", "cloudnet.notify");
    }

    try {
        Method setColor = team.getClass().getDeclaredMethod("setColor", ChatColor.class);
        setColor.setAccessible(true);
        if (permissionGroup.getColor().length() != 0) {
            setColor.invoke(team, ChatColor.getByChar(permissionGroup.getColor().replaceAll("&", "").replaceAll("§", "")));
        } else {
            setColor.invoke(team, ChatColor.getByChar(ChatColor.getLastColors(permissionGroup.getPrefix().replace('&', '§'))
                                                               .replaceAll("&", "")
                                                               .replaceAll("§", "")));
        }
    } catch (NoSuchMethodException ignored) {
    } catch (IllegalAccessException | InvocationTargetException e) {
        e.printStackTrace();
    }


    team.setPrefix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getPrefix()));
    team.setSuffix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getSuffix()));

    team.addEntry(target.getName());

    target.setDisplayName(ChatColor.translateAlternateColorCodes('&', permissionGroup.getDisplay() + target.getName()));
}
 
源代码6 项目: ProjectAres   文件: WorldProblemMatchModule.java
void broadcastDeveloperWarning(String message) {
    logger.warning(message);
    Bukkit.broadcast(ChatColor.RED + message, Permissions.MAPERRORS);
}
 
源代码7 项目: Skript   文件: Skript.java
public static void adminBroadcast(final String message) {
	Bukkit.broadcast(SKRIPT_PREFIX + Utils.replaceEnglishChatStyles(message), "skript.admin");
}
 
源代码8 项目: skUtilities   文件: skUtilities.java
public static void prSysE(String s, String c) {
  Bukkit.getServer().getLogger().severe("[skUtilities] v" + getVer() + ": " + s + " (" + c + ".class)");
  if (Bukkit.getPluginManager().getPlugin("skUtilities").getConfig().getBoolean("broadcastErrors", true)) {
    Bukkit.broadcast(ChatColor.RED + "[skUtilities: WARN]" + ChatColor.GRAY + " v" + getVer() + ": " + s + " (" + c + ".class)", "skUtilities.error");
  }
}
 
源代码9 项目: Skript   文件: Skript.java
/**
 * @param message
 * @param permission
 * @see #adminBroadcast(String)
 */
public static void broadcast(final String message, final String permission) {
	Bukkit.broadcast(SKRIPT_PREFIX + Utils.replaceEnglishChatStyles(message), permission);
}