Search in sources :

Example 1 with ChatColor

use of org.bukkit.ChatColor in project TotalFreedomMod by TotalFreedom.

the class Command_colorme method run.

@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
    if (args.length != 1) {
        return false;
    }
    if ("list".equalsIgnoreCase(args[0])) {
        msg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", "));
        return true;
    }
    final String needle = args[0].trim().toLowerCase();
    ChatColor color = null;
    final Iterator<Map.Entry<String, ChatColor>> it = FUtil.CHAT_COLOR_NAMES.entrySet().iterator();
    while (it.hasNext()) {
        final Map.Entry<String, ChatColor> entry = it.next();
        if (entry.getKey().contains(needle)) {
            color = entry.getValue();
            break;
        }
    }
    if (color == null) {
        msg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors.");
        return true;
    }
    final String newNick = color + ChatColor.stripColor(playerSender.getDisplayName()).trim() + ChatColor.WHITE;
    plugin.esb.setNickname(sender.getName(), newNick);
    msg("Your nickname is now: " + newNick);
    return true;
}
Also used : ChatColor(org.bukkit.ChatColor) Map(java.util.Map)

Example 2 with ChatColor

use of org.bukkit.ChatColor in project GameCore by Warvale.

the class GlobalEvent method onPlayerDeath.

@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
    event.setDeathMessage("");
    Player vName = event.getEntity();
    Player kName = vName.getKiller();
    ChatColor gray = ChatColor.GRAY;
    String victim = (Main.getTeams().getBlueTeam().hasPlayer(vName) ? ChatColor.DARK_AQUA + vName.getName() : (Main.getTeams().getRedTeam().hasPlayer(vName) ? ChatColor.RED + vName.getName() : ChatColor.AQUA + vName.getName()));
    String killer = (Main.getTeams().getBlueTeam().hasPlayer(kName) ? ChatColor.DARK_AQUA + kName.getName() : (Main.getTeams().getRedTeam().hasPlayer(kName) ? ChatColor.RED + kName.getName() : ChatColor.AQUA + kName.getName()));
    ArrayList<String> deathMessages = new ArrayList<>();
    deathMessages.addAll(Arrays.asList(killer + gray + " squished " + victim + gray + " like a bug.", killer + gray + " delivered the final coup de grĂ¢ce to " + victim, killer + gray + " assassinated " + victim, killer + gray + " put " + victim + gray + " out of their misery.", killer + gray + " showed no mercy to " + victim, killer + gray + " back-stabbed " + victim, killer + gray + " slayed " + victim, killer + gray + " brutally beat " + victim, killer + gray + " rearranged " + victim + gray + "'s face.", killer + gray + " ended " + victim + gray + "'s pitiful existence.", killer + gray + " removed the limbs of " + victim, killer + gray + " answered " + victim + "'s plea for death.", gray + "Thanks to " + killer + gray + ", " + victim + gray + " no longer exists.", killer + gray + " proved that " + victim + gray + " was no match for them.", killer + gray + " sent " + victim + gray + " to their grave."));
    int r = NumberUtils.random(deathMessages.size() - 1, 0);
    vName.sendMessage(deathMessages.get(r));
    kName.sendMessage(deathMessages.get(r));
}
Also used : Player(org.bukkit.entity.Player) ArrayList(java.util.ArrayList) ChatColor(org.bukkit.ChatColor) EventHandler(org.bukkit.event.EventHandler)

Example 3 with ChatColor

use of org.bukkit.ChatColor in project Denizen-For-Bukkit by DenizenScript.

the class Messaging method prettify.

private static String prettify(String message) {
    String trimmed = message.trim();
    String messageColor = Colorizer.parseColors(MESSAGE_COLOUR);
    if (!trimmed.isEmpty()) {
        if (trimmed.charAt(0) == ChatColor.COLOR_CHAR) {
            ChatColor test = ChatColor.getByChar(trimmed.substring(1, 2));
            if (test == null) {
                message = messageColor + message;
            }
        } else {
            message = messageColor + message;
        }
    }
    return message;
}
Also used : ChatColor(org.bukkit.ChatColor)

Example 4 with ChatColor

use of org.bukkit.ChatColor in project CitizensAPI by CitizensDev.

the class Messaging method prettify.

private static String prettify(String message) {
    String trimmed = message.trim();
    String messageColour = Colorizer.parseColors(MESSAGE_COLOUR);
    if (!trimmed.isEmpty()) {
        if (trimmed.charAt(0) == ChatColor.COLOR_CHAR) {
            ChatColor test = ChatColor.getByChar(trimmed.substring(1, 2));
            if (test == null) {
                message = messageColour + message;
            } else
                messageColour = test.toString();
        } else {
            message = messageColour + message;
        }
    }
    message = message.replace("[[", Colorizer.parseColors(HIGHLIGHT_COLOUR));
    return CHAT_NEWLINE.matcher(message).replaceAll("<n>]]").replace("]]", messageColour);
}
Also used : ChatColor(org.bukkit.ChatColor)

Example 5 with ChatColor

use of org.bukkit.ChatColor in project MagicPlugin by elBukkit.

the class BaseMagicProperties method describe.

public void describe(CommandSender sender, @Nullable Set<String> ignoreProperties, @Nullable Set<String> overriddenProperties) {
    ConfigurationSection itemConfig = getConfiguration();
    Set<String> keys = itemConfig.getKeys(false);
    for (String key : keys) {
        Object value = itemConfig.get(key);
        if (value != null && (ignoreProperties == null || !ignoreProperties.contains(key))) {
            ChatColor propertyColor = ChatColor.GRAY;
            if (overriddenProperties == null || !overriddenProperties.contains(key)) {
                propertyColor = PROPERTY_KEYS.contains(key) ? ChatColor.DARK_AQUA : ChatColor.DARK_GREEN;
            }
            sender.sendMessage(propertyColor.toString() + key + ChatColor.GRAY + ": " + ChatColor.WHITE + describeProperty(value));
        }
    }
}
Also used : ChatColor(org.bukkit.ChatColor) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Aggregations

ChatColor (org.bukkit.ChatColor)56 ArrayList (java.util.ArrayList)8 Player (org.bukkit.entity.Player)8 JSONObject (org.json.simple.JSONObject)6 IOException (java.io.IOException)4 SimpleDateFormat (java.text.SimpleDateFormat)3 Mage (com.elmakers.mine.bukkit.api.magic.Mage)2 PlayerVoteData (com.jaoafa.MyMaid2.Lib.PlayerVoteData)2 MassiveList (com.massivecraft.massivecore.collections.MassiveList)2 Method (java.lang.reflect.Method)2 SQLException (java.sql.SQLException)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 MaxMoneyException (net.ess3.api.MaxMoneyException)2 DyeColor (org.bukkit.DyeColor)2 Color (pl.themolka.arcade.util.Color)2 FancyMessage (br.net.fabiozumbi12.RedProtect.Bukkit.Fanciful.FancyMessage)1 RPGui (br.net.fabiozumbi12.RedProtect.Bukkit.RPGui)1 Region (br.net.fabiozumbi12.RedProtect.Bukkit.Region)1