public ListGames( Player player, String label, String[] args, FileConfiguration fileConfiguration) { if (GetGames.getGameNames(fileConfiguration) != null) { String[] games = GetGames.getGameNames(fileConfiguration); int i = 0; int imax = games.length; player.sendMessage( ConstantHolder.RAGEMODE_PREFIX + "Listing all available ragemode games..."); while (i < imax) { if (PlayerList.isGameRunning(games[i])) { player.sendMessage( i + 1 + ".) " + games[i] + ChatColor.GOLD.toString() + ChatColor.ITALIC.toString() + " running"); } else { player.sendMessage(i + 1 + ".) " + games[i] + ChatColor.GRAY + " idle"); } i++; } } else { player.sendMessage( ConstantHolder.RAGEMODE_PREFIX + "There are currently no RageMode maps on this server."); } }
@Override public String getReplacement(String inPattern) { // some formatting if (inPattern.contains("&bo")) { inPattern = inPattern.replace("&bo", ChatColor.BOLD.toString()); } if (inPattern.contains("&it")) { inPattern = inPattern.replace("&it", ChatColor.ITALIC.toString()); } if (inPattern.contains("&str")) { inPattern = inPattern.replace("&str", ChatColor.STRIKETHROUGH.toString()); } if (inPattern.contains("&ran")) { inPattern = inPattern.replace("&ran", ChatColor.MAGIC.toString()); } if (inPattern.contains("&un")) { inPattern = inPattern.replace("&un", ChatColor.UNDERLINE.toString()); } if (inPattern.contains("&no")) { inPattern = inPattern.replace("&no", ChatColor.RESET.toString()); } return inPattern; }
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player p = null; if (sender instanceof Player) { p = (Player) sender; } if (p != null) { if (!(p.isOp())) { return true; } } if (args.length == 0) { if (p != null) { if (!(p.isOp())) { return true; } p.sendMessage( ChatColor.RED + "Invalid Syntax. Please use /isay <msg> to send a local world messsage."); return true; } } String msg = ""; for (String s : args) { msg += s + " "; } msg = msg.substring(0, msg.lastIndexOf(" ")); msg = msg.replaceAll("&0", ChatColor.BLACK.toString()); msg = msg.replaceAll("&1", ChatColor.DARK_BLUE.toString()); msg = msg.replaceAll("&2", ChatColor.DARK_GREEN.toString()); msg = msg.replaceAll("&3", ChatColor.DARK_AQUA.toString()); msg = msg.replaceAll("&4", ChatColor.DARK_RED.toString()); msg = msg.replaceAll("&5", ChatColor.DARK_PURPLE.toString()); msg = msg.replaceAll("&6", ChatColor.GOLD.toString()); msg = msg.replaceAll("&7", ChatColor.GRAY.toString()); msg = msg.replaceAll("&8", ChatColor.DARK_GRAY.toString()); msg = msg.replaceAll("&9", ChatColor.BLUE.toString()); msg = msg.replaceAll("&a", ChatColor.GREEN.toString()); msg = msg.replaceAll("&b", ChatColor.AQUA.toString()); msg = msg.replaceAll("&c", ChatColor.RED.toString()); msg = msg.replaceAll("&d", ChatColor.LIGHT_PURPLE.toString()); msg = msg.replaceAll("&e", ChatColor.YELLOW.toString()); msg = msg.replaceAll("&f", ChatColor.WHITE.toString()); msg = msg.replaceAll("&u", ChatColor.UNDERLINE.toString()); msg = msg.replaceAll("&s", ChatColor.BOLD.toString()); msg = msg.replaceAll("&i", ChatColor.ITALIC.toString()); msg = msg.replaceAll("&m", ChatColor.MAGIC.toString()); if (sender instanceof BlockCommandSender) { BlockCommandSender cb = (BlockCommandSender) sender; for (Player pl : cb.getBlock().getWorld().getPlayers()) { pl.sendMessage(msg); } } else if (sender instanceof Player) { for (Player pl : p.getWorld().getPlayers()) { pl.sendMessage(msg); } } return true; }