Пример #1
0
  /**
   * This is my favorite debug routine :) I use it everywhere to print out variable values
   *
   * @param s - array of any object that you need to print out. Example: Message.BC ("variable
   *     1:",var1,"variable 2:",var2)
   */
  public static void BC(Object... s) {
    if (!debugMode) return;
    if (s.length == 0) return;

    StringBuilder sb =
        new StringBuilder("&3[").append(plugin.getDescription().getName()).append("]&f ");
    for (Object str : s) sb.append(str.toString()).append(" ");
    plugin.getServer().broadcastMessage(TextFormat.colorize(sb.toString().trim()));
  }
Пример #2
0
 /**
  * Send message to all players or to players with defined permission
  *
  * @param permission
  * @param s
  * @return Examples: Message.MSG_BROADCAST.broadcast ("pluginname.broadcast"); // send message to
  *     all players with permission "pluginname.broadcast" Message.MSG_BROADCAST.broadcast (null);
  *     // send message to all players
  */
 public boolean broadcast(String permission, Object... s) {
   for (Player player : plugin.getServer().getOnlinePlayers().values()) {
     if (permission == null || player.hasPermission(permission)) print(player, s);
   }
   return true;
 }