本文整理汇总了Java中org.bukkit.ChatColor.values方法的典型用法代码示例。如果您正苦于以下问题:Java ChatColor.values方法的具体用法?Java ChatColor.values怎么用?Java ChatColor.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.ChatColor
的用法示例。
在下文中一共展示了ChatColor.values方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTeam
import org.bukkit.ChatColor; //导入方法依赖的package包/类
private Map.Entry<Team, OfflinePlayer> createTeam(String text, int pos) {
Team team;
ChatColor color = ChatColor.values()[pos];
OfflinePlayer result;
if (!cache.containsKey(color.toString()))
cache.put(color.toString(), Bukkit.getOfflinePlayer(color.toString()));
result = cache.get(color.toString());
try {
team = scoreboard.registerNewTeam("text-" + (teams.size() + 1));
} catch (IllegalArgumentException e) {
team = scoreboard.getTeam("text-" + (teams.size()));
}
applyText(team, text, result);
teams.add(team);
return new AbstractMap.SimpleEntry<>(team, result);
}
示例2: getAllBlanks
import org.bukkit.ChatColor; //导入方法依赖的package包/类
private static List<String> getAllBlanks() {
List<String> toReturn = new ArrayList<>();
for (ChatColor chatColor : ChatColor.values()) {
toReturn.add(chatColor + "" + ChatColor.RESET);
for (ChatColor chatColor1 : ChatColor.values()) {
if (toReturn.size() >= 60) {
return toReturn;
}
toReturn.add(chatColor + "" + chatColor1 + ChatColor.RESET);
}
}
return toReturn;
}
示例3: markupToChat
import org.bukkit.ChatColor; //导入方法依赖的package包/类
public static String markupToChat(String markdown) {
//markdown = markdown.replaceAll("(\\*\\*|__)(?=\\S)(.*?\\S[*_]*)\\1", "<b>$2</b>");
markdown = markdown.replaceAll("(" + Surrounders.BOLD_1.getChars() + ")(?=\\S)(.*?\\S[*_]*)\\1", Surrounders.BOLD_1.getReplacements());
markdown = markdown.replaceAll("(" + Surrounders.BOLD_2.getChars() + ")(?=\\S)(.*?\\S[*_]*)\\1", Surrounders.BOLD_2.getReplacements());
markdown = markdown.replaceAll("(" + Surrounders.ITALIC_1.getChars() + ")(?=\\S)(.*?\\S[*_]*)\\1", Surrounders.ITALIC_1.getReplacements());
markdown = markdown.replaceAll("(" + Surrounders.ITALIC_2.getChars() + ")(?=\\S)(.*?\\S[*_]*)\\1", Surrounders.ITALIC_2.getReplacements());
markdown = markdown.replaceAll("(" + Surrounders.STRIKETHROUGH.getChars() + ")(?=\\S)(.*?\\S[*_]*)\\1", Surrounders.STRIKETHROUGH.getReplacements());
markdown = markdown.replaceAll("(" + Surrounders.OBFUSCATED.getChars() + ")(?=\\S)(.*?\\S[*_]*)\\1", Surrounders.OBFUSCATED.getReplacements());
for (ChatColor color : ChatColor.values()) {
//markdown = markdown.replace("&" + color.name().toLowerCase() + " ", ChatColor.translateAlternateColorCodes('&', "&" + color.getChar()));
//markdown = markdown.replace("&" + color.name().toLowerCase(), "" + ChatColor.translateAlternateColorCodes('&', "&" + color.getChar()));
markdown = markdown.replaceAll("(" + "&" + color.name().toLowerCase() + ")(?=\\S)(.*?\\S[*_]*)&", ChatColor.translateAlternateColorCodes('&', "&" + color.getChar()) + "$2" + ChatColor.RESET);
markdown = markdown.replaceAll("(" + "&" + color.name().toLowerCase() + " )(?=\\S)(.*?\\S[*_]*)&", ChatColor.translateAlternateColorCodes('&', "&" + color.getChar()) + "$2" + ChatColor.RESET);
}
//System.out.println(markdown);
return markdown;
}
示例4: format
import org.bukkit.ChatColor; //导入方法依赖的package包/类
public static String format(String string) {
String s = string;
for (ChatColor color : ChatColor.values()) {
s = s.replaceAll("(?i)<" + color.name() + ">", "" + color);
}
return s;
}
示例5: replaceColors
import org.bukkit.ChatColor; //导入方法依赖的package包/类
private String replaceColors(String message)
{
String s = message;
for (ChatColor color : ChatColor.values())
{
s = s.replaceAll("(?i)&" + color.getChar(), "" + color);
}
return s;
}
示例6: nextColor
import org.bukkit.ChatColor; //导入方法依赖的package包/类
private ChatColor nextColor()
{
ChatColor color = ChatColor.values()[getColorsUsed().size()];
getColorsUsed().add(color);
return color;
}
示例7: getRandomChatColor
import org.bukkit.ChatColor; //导入方法依赖的package包/类
private ChatColor getRandomChatColor(){
ChatColor c = ChatColor.values()[new Random().nextInt(ChatColor.values().length)];
return c;
}
示例8: getRandomChatColor
import org.bukkit.ChatColor; //导入方法依赖的package包/类
private ChatColor getRandomChatColor(){
return ChatColor.values()[new Random().nextInt(ChatColor.values().length)];
}