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;
}
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));
}
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;
}
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);
}
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));
}
}
}
Aggregations