本文整理汇总了Java中org.bukkit.ChatColor.GRAY属性的典型用法代码示例。如果您正苦于以下问题:Java ChatColor.GRAY属性的具体用法?Java ChatColor.GRAY怎么用?Java ChatColor.GRAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.ChatColor
的用法示例。
在下文中一共展示了ChatColor.GRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerChat
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent ev)
{
if (ev.isCancelled())
return ;
ev.setCancelled(true);
CPlayer cplayer = AgarMC.get().getGame().getCPlayer(ev.getPlayer());
if (cplayer == null)
return ;
String msg = "";
if (AgarMC.get().getGame().getGameType() == GameType.TEAMS)
{
TeamColor team = TeamColor.getTeam(cplayer.getColor());
msg += ChatColor.DARK_GRAY + "[" + (team == null ? ChatColor.DARK_RED + "ERROR" : team.getDisplayName()) + ChatColor.DARK_GRAY + "]";
}
if (cplayer.isPlaying())
msg += ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + cplayer.getTotalMass() + ChatColor.DARK_GRAY + "]";
if (!msg.isEmpty())
msg += " ";
msg += ChatColor.GRAY + ev.getPlayer().getName() + ChatColor.WHITE + ": " + ev.getMessage();
for (Player p : Bukkit.getOnlinePlayers())
p.sendMessage(msg);
Bukkit.getConsoleSender().sendMessage(msg);
}
示例2: onFactionChat
@EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
public void onFactionChat(FactionChatEvent event)
{
Player player = event.getPlayer();
Faction faction = event.getFaction();
String format = ChatColor.GOLD + "[" + ChatColor.RED + event.getChatChannel().getDisplayName() + ": " + ChatColor.YELLOW + faction.getName() + ChatColor.GOLD + "] " + ChatColor.GRAY + event.getFactionMember().getRole().getAstrix() + player.getName() + ": " + ChatColor.YELLOW + event.getMessage();
HashSet<Player> recipients = new HashSet();
recipients.removeAll(event.getRecipients());
for (CommandSender recipient : recipients) {
if ((recipient instanceof Player))
{
Player target = (Player)recipient;
FactionUser user = event.isAsynchronous() ? this.plugin.getUserManager().getUserAsync(target.getUniqueId()) : this.plugin.getUserManager().getUser(player.getUniqueId());
Collection<UUID> spying = user.getFactionChatSpying();
if ((spying.contains(ALL_UUID)) || (spying.contains(faction.getUniqueID()))) {
recipient.sendMessage(format);
}
}
}
}
示例3: refreshTab
private void refreshTab(Player player) {
MatchStatus matchStatus = TGM.get().getMatchManager().getMatch().getMatchStatus();
ChatColor timeColor = ChatColor.GREEN;
if (matchStatus == MatchStatus.PRE) {
timeColor = ChatColor.GOLD;
} else if (matchStatus == MatchStatus.POST) {
timeColor = ChatColor.RED;
}
String header = ChatColor.WHITE + ChatColor.BOLD.toString() + TGM.get().getMatchManager().getMatch().getMapContainer().getMapInfo().getGametype().toString() +
ChatColor.DARK_GRAY + " - " + timeColor + Strings.formatTime(TGM.get().getMatchManager().getMatch().getModule(TimeModule.class).getTimeElapsed()) +
ChatColor.DARK_GRAY + " - " + ChatColor.WHITE + ChatColor.BOLD.toString() + "WARZONE";
String footer = "";
for (MatchTeam matchTeam : teamManagerModule.getTeams()) {
if (matchTeam.isSpectator()) continue;
footer += matchTeam.getColor() + matchTeam.getAlias() + ": " + ChatColor.WHITE + matchTeam.getMembers().size() + ChatColor.DARK_GRAY + "/" + ChatColor.GRAY + matchTeam.getMax();
footer += ChatColor.DARK_GRAY + " - ";
}
footer += ChatColor.AQUA + "Spectators: " + ChatColor.WHITE + TGM.get().getModule(TeamManagerModule.class).getSpectators().getMembers().size();
TitleAPI.sendTabTitle(player, header, footer);
}
示例4: onCommand
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
List<Arena> matches = Arena.getList();
String list = "";
for (Arena match : matches) {
ChatColor color = ChatColor.GRAY;
if (match.getState() != ArenaState.LOADING)
color = match.getState() == ArenaState.WAITING ? ChatColor.GREEN : ChatColor.RED;
String t = color + match.getCurrent().getTitle() + "&f, ";
list += t;
}
list = list.substring(0, list.length() - 2);
Chat.player(sender, "&7Arenas: " + list);
return true;
}
示例5: provideLore
private String[] provideLore(Player player, String... permissions) {
if (permissions != null && permissions.length == 1 && permissions[0] != null) {
if (permissions.length == 1 && permissions[0].equals("minecraft-heads")) {
return new String[]{ChatColor.GRAY + "Use exclusive pet heads as costume.", ChatColor.YELLOW + "Sponsored by Minecraft-Heads.com"};
}
if (permissions.length == 1 && permissions[0].equals("head-database")) {
final Plugin plugin = Bukkit.getPluginManager().getPlugin("HeadDatabase");
if (plugin == null) {
return new String[]{ChatColor.DARK_RED + "" + ChatColor.ITALIC + "Plugin is not installed - " + ChatColor.YELLOW + "Click me!"};
}
}
}
final String[] modifiedLore = new String[this.lore.length];
for (int i = 0; i < modifiedLore.length; i++) {
modifiedLore[i] = this.lore[i];
if (this.lore[i].contains("<permission>")) {
if (permissions != null && (permissions.length == 0 || this.hasPermission(player, permissions))) {
modifiedLore[i] = this.lore[i].replace("<permission>", Config.getInstance().getPermissionIconYes());
} else {
modifiedLore[i] = this.lore[i].replace("<permission>", Config.getInstance().getPermissionIconNo());
}
}
}
return modifiedLore;
}
示例6: sendMessage
public void sendMessage(String s) {
String msg = ChatColor.GRAY + "[" + ChatColor.YELLOW + "Dungeon" + ChatColor.GRAY + "] " + ChatColor.GREEN + s;
HashSet<String> toRemove = new HashSet<String>();
for (String uuid : players) {
PlayerDataRPG pd = DungeonManager.plugin.getPD(uuid);
if (pd != null && pd.getPlayer() != null && pd.getPlayer().isOnline() && checkRegion(pd.region))
pd.sendMessage(msg);
else
toRemove.add(uuid);
}
players.removeAll(toRemove);
}
示例7: getArmorString
public static String getArmorString(PlayerDataRPG pd) {
if (pd.horseArmor == null) {
return ChatColor.GRAY + "No Armor";
}
switch (pd.horseArmor) {
case IRON_BARDING:
return ChatColor.WHITE + "Iron Armor";
case GOLD_BARDING:
return ChatColor.GOLD + "Gold Armor";
case DIAMOND_BARDING:
return ChatColor.AQUA + "Diamond Armor";
default:
return ChatColor.GRAY + "No Armor";
}
}
示例8: renderSidebarStatusText
@Override
public String renderSidebarStatusText(@Nullable Competitor competitor, Party viewer) {
if(this.getShowProgress() || Parties.isObservingType(viewer)) {
String text = this.renderCompletion();
if(Config.Scoreboard.preciseProgress()) {
String precise = this.renderPreciseCompletion();
if(precise != null) {
text += " " + ChatColor.GRAY + precise;
}
}
return text;
} else {
return super.renderSidebarStatusText(competitor, viewer);
}
}
示例9: destroyableDestroy
@EventHandler(priority = EventPriority.MONITOR)
public void destroyableDestroy(final DestroyableDestroyedEvent event) {
if (event.getDestroyable().isVisible()) {
for (DestroyableContribution info : event.getDestroyable().getContributions()) {
String percentage = ChatColor.GREEN.toString() + ((int) (info.getPercentage() * 100)) + ChatColor.GRAY;
BaseComponent reason = new TranslatableComponent("match.destroyable.destroy", percentage, new Component(event.getDestroyable().getName(), net.md_5.bungee.api.ChatColor.GREEN));
giveRaindrops(info.getPlayerState().getPlayerId(), (int) (RaindropConstants.DESTROYABLE_DESTROY_PERCENT_REWARD * info.getPercentage()), reason);
}
}
}
示例10: addLoreAction
/**
* Add a lore action. Does not get added if an action with the same click type exists.
* @param click - The mouse click type that fires this action.
* @param action - The action to display.
* @return this
*/
public ItemWrapper addLoreAction(String click, String action) {
String control = ChatColor.WHITE + click + "-Click: " + ChatColor.GRAY;
for (String s : getLore())
if (s.startsWith(ChatColor.GRAY + control))
return this;
return addLore(control + action);
}
示例11: getSpectatorFormat
private String getSpectatorFormat(Player player, String message) {
return ChatColor.GRAY + "[Spectator]" + player.getName() + ": " + ChatColor.WHITE + message;
}
示例12: formatStaffChatReply
public static String formatStaffChatReply(Player from, Player to, String message) {
return ChatColor.RED + "" + ChatColor.BOLD + "[STAFF] " + ChatColor.BOLD + from.getDisplayName() + ChatColor.GRAY + " -> " + ChatColor.BOLD + to.getDisplayName() + ChatColor.DARK_GRAY + "" + ChatColor.BOLD + " >> " + ChatColor.WHITE + message;
}
示例13: printDetails
@Override
public void printDetails(final CommandSender sender) {
String leaderName = null;
final Set<String> allyNames = new HashSet<String>(SettingsYML.MAX_ALLIES_PER_FACTION);
for (final Map.Entry<UUID, Relation> entry : this.relations.entrySet()) {
final Faction faction = HCF.getPlugin().getFactionManager().getFaction(entry.getKey());
if (faction instanceof PlayerFaction) {
final PlayerFaction ally = (PlayerFaction)faction;
allyNames.add(ally.getDisplayName(sender) + ChatColor.GOLD + '[' + ChatColor.WHITE + ally.getOnlinePlayers(sender).size() + ChatColor.GRAY + '/' + ChatColor.WHITE + ally.members.size() + ChatColor.GOLD + ']');
}
}
int combinedKills = 0;
final Set<String> memberNames = new HashSet<String>();
final Set<String> captainNames = new HashSet<String>();
for (final Map.Entry<UUID, FactionMember> entry2 : this.members.entrySet()) {
final FactionMember factionMember = entry2.getValue();
final Player target = factionMember.toOnlinePlayer();
final FactionUser user = HCF.getPlugin().getUserManager().getUser(entry2.getKey());
final int kills = user.getKills();
combinedKills += kills;
final Deathban deathban = user.getDeathban();
ChatColor colour;
if (deathban != null && deathban.isActive()) {
colour = ChatColor.RED;
}
else if (target == null || (sender instanceof Player && !((Player)sender).canSee(target))) {
colour = ChatColor.GRAY;
}
else {
colour = ChatColor.GREEN;
}
final String memberName = colour + factionMember.getName() + ChatColor.GOLD + '[' + ChatColor.WHITE + kills + ChatColor.GOLD + ']';
switch (factionMember.getRole()) {
case LEADER: {
leaderName = memberName;
continue;
}
case CAPTAIN: {
captainNames.add(memberName);
continue;
}
case MEMBER: {
memberNames.add(memberName);
continue;
}
}
}
sender.sendMessage(ChatColor.DARK_GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT);
sender.sendMessage(ChatColor.AQUA + this.getDisplayName(sender) + ChatColor.GRAY + " (" + this.getOnlineMembers().size() + " of " + this.getMembers().size() + " online) ");
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + "Home " + ChatColor.GRAY + "§ " + ChatColor.RED.toString() + ChatColor.ITALIC + ((this.home == null) ? "None" : (ChatColor.WHITE.toString() + this.home.getLocation().getBlockX() + " | " + this.home.getLocation().getBlockZ())));
if (!allyNames.isEmpty()) {
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + "Allies " + ChatColor.GRAY + "§ " + StringUtils.join((Iterable)allyNames, ChatColor.GRAY + ", "));
}
if (leaderName != null) {
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + "Leader " + ChatColor.GRAY + "§ " + ChatColor.RED + leaderName);
}
if (!captainNames.isEmpty()) {
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + "Captains " + ChatColor.GRAY + "§ " + ChatColor.RED + StringUtils.join((Iterable)captainNames, ChatColor.GRAY + ", "));
}
if (!memberNames.isEmpty()) {
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + "Members " + ChatColor.GRAY + "§ " + ChatColor.RED + StringUtils.join((Iterable)memberNames, ChatColor.GRAY + ", "));
}
if (sender instanceof Player) {
final Faction playerFaction3 = HCF.getPlugin().getFactionManager().getPlayerFaction((Player)sender);
if (playerFaction3 != null && playerFaction3.equals(this) && this.announcement != null) {
sender.sendMessage(ChatColor.YELLOW + " Announcement: " + ChatColor.GREEN + this.announcement);
}
}
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + "Balance " + ChatColor.GRAY + "§ " + ChatColor.GREEN + '$' + this.balance);
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + "Deaths until Raidable " + ChatColor.GRAY + "§ " + this.getRegenStatus().getSymbol() + this.getDtrColour() + JavaUtils.format((Number)this.getDeathsUntilRaidable(false)));
final long dtrRegenRemaining = this.getRemainingRegenerationTime();
if (dtrRegenRemaining > 0L) {
sender.sendMessage(ChatColor.GRAY + "* " + ChatColor.YELLOW + " Time until Regen " + ChatColor.GRAY + "§ " + ChatColor.GREEN + DurationFormatUtils.formatDurationWords(dtrRegenRemaining, true, true));
}
sender.sendMessage(ChatColor.DARK_GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT);
}
示例14: getChatColor
public ChatColor getChatColor() {
if (rank == null)
return ChatColor.GRAY;
return rank.chatColor;
}
示例15: broadcastGreer
private void broadcastGreer(String message)
{
String prefix = ChatColor.RED + "[" + ChatColor.GRAY + "Greer" + ChatColor.RED + "] ";
Bukkit.broadcastMessage(prefix + ChatColor.RED + message);
}