Java Code Examples for org.bukkit.ChatColor#AQUA

The following examples show how to use org.bukkit.ChatColor#AQUA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RaindropsListener.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void displayScoreboard(final PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    final User user = userStore.getUser(player);
    final PlayerId playerId = tc.oc.api.bukkit.users.Users.playerId(player);
    final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    final Objective objective = getOrCreateObjective(scoreboard, player.getName(), "dummy");
    final String raindropsName = ChatColor.AQUA + "Raindrops";

    objective.setDisplayName(renderer.renderLegacy(generalFormatter.brandName(), event.getPlayer()));

    objective.getScore(raindropsName).setScore(2);
    Utils.displayScoreboard(player, objective);
    setRaindropsCount(player, user.raindrops());
    GizmoUtils.setGizmo(player, Gizmos.emptyGizmo, true);
}
 
Example 2
Source File: PrefixTest.java    From UHC with MIT License 6 votes vote down vote up
@Test
public void testContainsColoursTwoFormatting() throws Exception {
    Prefix prefix = new Prefix(ChatColor.AQUA, ChatColor.ITALIC, ChatColor.BOLD);

    assertThat(prefix.containsColours(false, ChatColor.AQUA)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.AQUA)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.BLUE)).isFalse();
    assertThat(prefix.containsColours(true, ChatColor.BLUE)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.ITALIC)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.ITALIC)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.AQUA, ChatColor.ITALIC)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.AQUA, ChatColor.ITALIC)).isFalse();

    assertThat(prefix.containsColours(true, ChatColor.BLUE, ChatColor.ITALIC)).isFalse();
    assertThat(prefix.containsColours(true, ChatColor.BLUE, ChatColor.ITALIC)).isFalse();
}
 
Example 3
Source File: SidebarMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
private static String renderSidebarTitle(
    Collection<MapTag> tags, @Nullable Component gamemodeName) {
  final Component configTitle = PGM.get().getConfiguration().getMatchHeader();
  if (configTitle != null) return LegacyComponentSerializer.legacy().serialize(configTitle);
  if (gamemodeName != null) {
    String customGamemode = LegacyComponentSerializer.legacy().serialize(gamemodeName);
    if (!customGamemode.isEmpty()) return ChatColor.AQUA + customGamemode;
  }

  final List<String> gamemode =
      tags.stream()
          .filter(MapTag::isGamemode)
          .filter(tag -> !tag.isAuxiliary())
          .map(MapTag::getName)
          .collect(Collectors.toList());
  final List<String> auxiliary =
      tags.stream()
          .filter(MapTag::isGamemode)
          .filter(MapTag::isAuxiliary)
          .map(MapTag::getName)
          .collect(Collectors.toList());

  String title = "";

  if (gamemode.size() == 1) {
    title = gamemode.get(0);
  } else if (gamemode.size() >= 2) {
    title = "Objectives";
  }

  if (auxiliary.size() == 1) {
    title += (title.isEmpty() ? "" : " & ") + auxiliary.get(0);
  } else if (gamemode.isEmpty() && auxiliary.size() == 2) {
    title = auxiliary.get(0) + " & " + auxiliary.get(1);
  }

  return ChatColor.AQUA + (title.isEmpty() ? "Match" : title);
}
 
Example 4
Source File: ScoreboardSlot.java    From 1.13-Command-API with Apache License 2.0 5 votes vote down vote up
/**
 * Determines the scoreboard slot value based on an internal Minecraft integer
 * @param i the scoreboard slot value
 */
public ScoreboardSlot(int i) {
	//Initialize displaySlot
	switch(i) {
		case 0: displaySlot = DisplaySlot.PLAYER_LIST; break;
		case 1: displaySlot = DisplaySlot.SIDEBAR; break;
		case 2: displaySlot = DisplaySlot.BELOW_NAME; break;
		default: displaySlot = DisplaySlot.SIDEBAR; break;
	}
	
	//Initialize teamColor
	switch(i) {
		case 3: teamColor = ChatColor.BLACK; break;
		case 4: teamColor = ChatColor.DARK_BLUE; break;
		case 5: teamColor = ChatColor.DARK_GREEN; break;
		case 6: teamColor = ChatColor.DARK_AQUA; break;
		case 7: teamColor = ChatColor.DARK_RED; break;
		case 8: teamColor = ChatColor.DARK_PURPLE; break;
		case 9: teamColor = ChatColor.GOLD; break;
		case 10: teamColor = ChatColor.GRAY; break;
		case 11: teamColor = ChatColor.DARK_GRAY; break;
		case 12: teamColor = ChatColor.BLUE; break;
		case 13: teamColor = ChatColor.GREEN; break;
		case 14: teamColor = ChatColor.AQUA; break;
		case 15: teamColor = ChatColor.RED; break;
		case 16: teamColor = ChatColor.LIGHT_PURPLE; break;
		case 17: teamColor = ChatColor.YELLOW; break;
		case 18: teamColor = ChatColor.WHITE; break;
		default: teamColor = null; break;
	}
}
 
Example 5
Source File: MapLogRecord.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public String getLegacyFormattedMessage() {
    String message = ChatColor.AQUA + getLocation() + ": " + ChatColor.RED + getMessage();

    Throwable thrown = getThrown();
    if(thrown != null && thrown.getCause() != null && thrown.getCause().getMessage() != null) {
        message += ", caused by: " + thrown.getCause().getMessage();
    }

    return message;
}
 
Example 6
Source File: ProximityCommand.java    From CardinalPGM with MIT License 5 votes vote down vote up
private static String getObjective(GameObjective objective, GameObjectiveProximityHandler proximityHandler) {
    String message = "  ";
    if (objective instanceof WoolObjective) message += MiscUtil.convertDyeColorToChatColor(((WoolObjective)objective).getColor());
    if (objective instanceof FlagObjective) message += ((FlagObjective) objective).getChatColor();
    message += WordUtils.capitalizeFully(objective.getName().replaceAll("_", " ")) + " ";
    message += objective.isComplete() ? ChatColor.GREEN + "COMPLETE " : objective.isTouched() ? ChatColor.YELLOW + "TOUCHED " : ChatColor.RED + "UNTOUCHED ";
    if (proximityHandler != null && !objective.isComplete()) {
        message += ChatColor.GRAY + proximityHandler.getProximityName() + ": ";
        message += ChatColor.AQUA + proximityHandler.getProximityAsString();
    }
    return message;
}
 
Example 7
Source File: StartTimer.java    From CardinalPGM with MIT License 5 votes vote down vote up
private ChatMessage waitingPlayerMessage(int players) {
    List<TeamModule> teams = Teams.getTeams().stream()
            .filter((team) -> !team.isObserver() && team.size() < team.getMin()).limit(2).collect(Collectors.toList());
    return new UnlocalizedChatMessage(ChatColor.RED + "{0}",
            new LocalizedChatMessage(players == 1 ? ChatConstant.UI_WAITING_PLAYER : ChatConstant.UI_WAITING_PLAYERS,
                    ChatColor.AQUA + "" + players + ChatColor.RED,
                    teams.size() == 1 ? teams.get(0).getCompleteName() : ""));
}
 
Example 8
Source File: UpdateChecker.java    From skUtilities with GNU General Public License v3.0 5 votes vote down vote up
private void prSysU(String s) {
    if (broadcastUpdates) {
        String message = ChatColor.AQUA + "[" + plugin.getName() + ": Update] " + ChatColor.GRAY + s;
        Bukkit.broadcast(message, plugin.getName() + ".update");
    }
    skUtilities.prSysI(s);
}
 
Example 9
Source File: ScoreboardModule.java    From CardinalPGM with MIT License 5 votes vote down vote up
public String getDisplayTitle() {
    String displayTitle = "";
    boolean hasObjectives = false;
    for (GameObjective obj : GameHandler.getGameHandler().getMatch().getModules().getModules(GameObjective.class)) {
        if (obj.showOnScoreboard()) {
            hasObjectives = true;
        }
    }
    Class objective = getSpecificObjective();
    if (hasObjectives) {
        if (objective != null) {
            if (objective.equals(WoolObjective.class)) {
                displayTitle = "Wools";
            } else if (objective.equals(FlagObjective.class)) {
                displayTitle = "Flags";
            } else if (objective.equals(CoreObjective.class)) {
                displayTitle = "Cores";
            } else if (objective.equals(DestroyableObjective.class)) {
                displayTitle = "Monuments";
            } else if (objective.equals(HillObjective.class)) {
                displayTitle = "Hills";
            }
        } else {
            displayTitle = "Objectives";
        }
    }
    if (ScoreModule.matchHasScoring()) {
        displayTitle = displayTitle.equals("") || displayTitle.equals("Flags")|| displayTitle.equals("Hills") ? "Scores" : "Objectives";
    }
    if (Blitz.matchIsBlitz()) {
        String blitzTitle = GameHandler.getGameHandler().getMatch().getModules().getModule(Blitz.class).getTitle();
        displayTitle = (blitzTitle.equals("Blitz") || blitzTitle.equals("Blitz: Rage")) ? (displayTitle.equals("") ? blitzTitle : "Players Remaining") : blitzTitle;
    }
    if (displayTitle.equals("")) {
        return ChatColor.RED + "" + ChatColor.BOLD + "Invalid";
    }
    return ChatColor.AQUA + displayTitle;
}
 
Example 10
Source File: ViewConversation.java    From ServerTutorial with MIT License 4 votes vote down vote up
@Override
public String getPrefix(ConversationContext context) {
    return ChatColor.AQUA + "[" + ChatColor.GRAY + "Tutorial" + ChatColor.AQUA + "] " + ChatColor.WHITE;
}
 
Example 11
Source File: FlagObjective.java    From CardinalPGM with MIT License 4 votes vote down vote up
private void updateArmorStand() {
    if (armorStand == null || armorStand.isDead()) armorStand = createArmorStand();
    String suffix = isDropped() && GameHandler.getGameHandler().getMatch().isRunning() ? ChatColor.AQUA + " " + getRecoverTime() : "";
    armorStand.setCustomName(getDisplayName() + suffix);
}
 
Example 12
Source File: FlagBuilder.java    From CardinalPGM with MIT License 4 votes vote down vote up
private ModuleCollection<? extends Module> getFlag(Element... elements) {
    ModuleCollection<Module> result =  new ModuleCollection<>();
    String id = elements[0].getAttributeValue("id");
    boolean required = Numbers.parseBoolean(Parser.getOrderedAttribute("required", elements), true);
    String name = elements[0].getAttributeValue("name");
    boolean show = Numbers.parseBoolean(Parser.getOrderedAttribute("show", elements), true);
    Post post = Flags.getPostById(Parser.getOrderedAttribute("post", elements));
    if (post == null) post = PostBuilder.parsePostElement(elements[0].getChild("post"));
    result.add(post);
    Set<Net> nets = new HashSet<>();
    if (elements[0].getChildren("net").size() > 0) {
        for (Element netEl : elements[0].getChildren("net")) {
            Net net = NetBuilder.parseNet(Parser.addElement(netEl, elements));
            nets.add(net);
            result.add(net);
        }
    }
    TeamModule owner = Parser.getOrderedAttribute("owner", elements) == null ? null : Teams.getTeamById(Parser.getOrderedAttribute("owner", elements)).orNull();
    boolean shared = Numbers.parseBoolean(Parser.getOrderedAttribute("shared", elements), false);
    DyeColor color = Parser.getOrderedAttribute("color", elements) == null ? ((Banner)post.getInitialBlock().getState()).getBaseColor() : Parser.parseDyeColor(Parser.getOrderedAttribute("color", elements));
    ChatColor chatColor = MiscUtil.convertBannerColorToChatColor(color);
    String carryMessage = ChatColor.AQUA + "" + ChatColor.BOLD + "You are carrying " + chatColor + ChatColor.BOLD + name;
    if (Parser.getOrderedAttributeOrChild("carry-message", elements) != null) carryMessage = ChatColor.translateAlternateColorCodes('`', Parser.getOrderedAttributeOrChild("carry-message", elements));
    int points = Numbers.parseInt(Parser.getOrderedAttribute("points", elements), 0);
    int pointsRate = Numbers.parseInt(Parser.getOrderedAttribute("points-rate", elements), 0);
    FilterModule pickupFilter = FilterModuleBuilder.getAttributeOrChild("pickup-filter", post.getPickupFilter(), elements);
    FilterModule dropFilter = FilterModuleBuilder.getAttributeOrChild("drop-filter", "always", elements);
    FilterModule captureFilter = FilterModuleBuilder.getAttributeOrChild("capture-filter", nets.size() > 0 ? nets.iterator().next().getCaptureFilter() : FilterModuleBuilder.getFilter("always"), elements);
    KitNode pickupKit = getKitOrChild("pickup-kit", result, elements);
    KitNode dropKit = getKitOrChild("drop-kit", result, elements);
    KitNode carryKit = getKitOrChild("carry-kit", result, elements);
    boolean dropOnWater = Numbers.parseBoolean(Parser.getOrderedAttribute("drop-on-water", elements), true);
    boolean beam = Numbers.parseBoolean(Parser.getOrderedAttribute("beam", elements), true);

    String flagProximityMetric = Parser.getOrderedAttribute("flagproximity-metric", elements);
    Boolean flagProximityHorizontal = Numbers.parseBoolean(Parser.getOrderedAttribute("flagproximity-horizontal", elements), false);
    ProximityInfo flagProximityInfo = new ProximityInfo(post.getInitialBlock().getLocation().toVector(), flagProximityHorizontal, false,
        flagProximityMetric == null ? GameObjectiveProximityHandler.ProximityMetric.CLOSEST_KILL : GameObjectiveProximityHandler.ProximityMetric.getByName(flagProximityMetric));

    String netProximityMetric = Parser.getOrderedAttribute("netproximity-metric", elements);
    Boolean netProximityHorizontal = Numbers.parseBoolean(Parser.getOrderedAttribute("netproximity-horizontal", elements), false);
    ProximityInfo netProximityInfo = new ProximityInfo(null, netProximityHorizontal, true,
            netProximityMetric == null ? GameObjectiveProximityHandler.ProximityMetric.CLOSEST_PLAYER : GameObjectiveProximityHandler.ProximityMetric.getByName(netProximityMetric));

    Map<String, GameObjectiveProximityHandler> flagProximityHandlers = new HashMap<>();
    Map<String, GameObjectiveProximityHandler> netProximityHandlers = new HashMap<>();
    for (TeamModule offender : Teams.getTeams()) {
        if (offender.isObserver() || offender == owner || !pickupFilter.evaluate(offender).equals(FilterState.ALLOW)) continue;
        GameObjectiveProximityHandler flagProximityHandler = new GameObjectiveProximityHandler(offender, flagProximityInfo);
        GameObjectiveProximityHandler netProximityHandler = new GameObjectiveProximityHandler(offender, netProximityInfo);
        flagProximityHandlers.put(offender.getId(), flagProximityHandler);
        netProximityHandlers.put(offender.getId(), netProximityHandler);
        result.add(flagProximityHandler);
        result.add(netProximityHandler);
    }
    result.add(new FlagObjective(id, required, name, color, chatColor, show, post, owner, shared, carryMessage, points, pointsRate, pickupFilter, dropFilter, captureFilter, pickupKit, dropKit, carryKit, dropOnWater, beam, nets, flagProximityHandlers, netProximityHandlers));

    return result;
}
 
Example 13
Source File: Util.java    From ObsidianDestroyer with GNU General Public License v3.0 4 votes vote down vote up
public static String header() {
    return ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "ObsidianDestroyer" + ChatColor.DARK_AQUA + "] " + ChatColor.RESET;
}
 
Example 14
Source File: EventsMenu.java    From SkyWarsReloaded with GNU General Public License v3.0 4 votes vote down vote up
EventsMenu(final Player player, GameMap gMap) {

		int menuSize = 27;
		Inventory inv = Bukkit.createInventory(null, menuSize + 9, menuName + gMap.getName());
    	List<String> lores = new ArrayList<>();
    	for (MatchEvent event: gMap.getEvents()) {
    		lores.clear();
    		String part1;
    		String part2;
    		String part3;
    		String part4;
    		if (event.isEnabled()) {
    			part1 = ChatColor.GREEN + "Event Enabled";
    			part3 = ChatColor.AQUA + "Left Click to Disable";
    		} else {
    			part1 = ChatColor.RED + "Event Disabled";
    			part3 = ChatColor.AQUA + "Left Click to Enable";
    		}
    		if (event.hasFired()) {
    			part2 = ChatColor.GREEN + "Event is Ongoing";
    			part4 = ChatColor.GOLD + "Right Click to End the Event";
    		} else {
    			part2 = ChatColor.RED + "Event is not Running";
    			part4 = ChatColor.GOLD + "Right Click to Force Start Event";
    		}

    		lores.add(part1);
    		lores.add(part2);
    		lores.add(part3);
    		lores.add(part4);
    		ItemStack item = SkyWarsReloaded.getNMS().getItemStack(event.getMaterial(), lores, event.getTitle());
    		inv.setItem(event.getSlot(), item);
    	}
               
        ArrayList<Inventory> invs = new ArrayList<>();
        invs.add(inv);

        SkyWarsReloaded.getIC().create(player, invs, event -> {
			String name = event.getName();
			if (name.equalsIgnoreCase(SkyWarsReloaded.getNMS().getItemName(SkyWarsReloaded.getIM().getItem("exitMenuItem")))) {
				SkyWarsReloaded.getIC().show(player, gMap.getArenaKey());
				new BukkitRunnable() {
					@Override
					public void run() {
						gMap.updateArenaManager();
					}
				}.runTaskLater(SkyWarsReloaded.get(), 2);
				return;
			}
			MatchEvent mEvent = null;
			for (MatchEvent e: gMap.getEvents()) {
				if(ChatColor.translateAlternateColorCodes('&', e.getTitle()).equals(name)) {
					mEvent = e;
					break;
				}
			}
			if (mEvent != null) {
				if (event.getClick().equals(ClickType.RIGHT)) {
					if (mEvent.hasFired()) {
						mEvent.endEvent(true);
					} else {
						mEvent.doEvent();
					}
					new EventsMenu(player, gMap);
				} else if (event.getClick().equals(ClickType.LEFT)) {
					mEvent.setEnabled(!mEvent.isEnabled());
					mEvent.saveEventData();
					new EventsMenu(player, gMap);
				}
			}
		});
                
        if (player != null) {
            SkyWarsReloaded.getIC().show(player, null);
        }
    }
 
Example 15
Source File: Stats.java    From CardinalPGM with MIT License 4 votes vote down vote up
private void sendTeamPackets(Player player, boolean set) {
    String prefix = "K:" + ChatColor.GREEN + "0";
    String suffix = "0" + ChatColor.WHITE + " K/D:" + ChatColor.AQUA + "0.00";
    PacketUtils.sendPacket(player, new PacketPlayOutScoreboardTeam(set ? 0 : 1, "scoreboard-stats", "scoreboard-stats", prefix, suffix, -1, "never", "never", 0, Collections.singletonList(scoreboardEntry)));
}
 
Example 16
Source File: Stats.java    From CardinalPGM with MIT License 4 votes vote down vote up
private ChatMessage getLocalizedMessage(int kills, int deaths, String kd) {
    return new LocalizedChatMessage(ChatConstant.UI_STATS_DISPLAY, ChatColor.GREEN + "" + kills + ChatColor.WHITE, ChatColor.RED + "" + deaths + ChatColor.WHITE, ChatColor.AQUA + kd + ChatColor.WHITE);
}
 
Example 17
Source File: Swapper.java    From AnnihilationPro with MIT License 4 votes vote down vote up
@Override
protected String defaultSpecialItemName()
{
	return ChatColor.AQUA+"Swapper";
}
 
Example 18
Source File: BookOfSoulsCI.java    From NBTEditor with GNU General Public License v3.0 4 votes vote down vote up
public BookOfSoulsCI() {
	super("bos", ChatColor.AQUA + "Book of Souls", Material.WRITTEN_BOOK);
}
 
Example 19
Source File: Stats.java    From CardinalPGM with MIT License 4 votes vote down vote up
public void updateDisplay(final Player player) {
    if (!shouldShow(player)) return;

    final int kills = getKills(player.getUniqueId());
    final int deaths = getDeaths(player.getUniqueId());
    final String kd = format.format((double)kills / Math.max(deaths, 1)).replace(",", ".");

    switch (Settings.getSettingByName("Stats").getValueByPlayer(player).getValue()) {
        case "sidebar":
            if (!sidebarView.contains(player.getUniqueId())) {
                sidebarView.add(player.getUniqueId());
                sendTeamPackets(player, true);
            }
            sendSlotPackets(player, true);
            String prefix = "K:" + ChatColor.GREEN + Math.min(kills, 999);
            String suffix = "" + Math.min(deaths, 999) + ChatColor.WHITE + " K/D:" + ChatColor.AQUA + kd;
            PacketUtils.sendPacket(player, new PacketPlayOutScoreboardTeam(2, "scoreboard-stats", "scoreboard-stats", prefix, suffix, -1, "never", "never", 0, Collections.singletonList(scoreboardEntry)));
            break;
        case "boss bar":
            if (!bossBars.containsKey(player.getUniqueId())) {
                LocalizedBossBar bossBar = new LocalizedBossBar(new UnlocalizedChatMessage(""), BarColor.PURPLE, BarStyle.SOLID);
                bossBar.addPlayer(player);
                bossBars.put(player.getUniqueId(), bossBar);
            }
            bossBars.get(player.getUniqueId()).setTitle(getLocalizedMessage(kills, deaths, kd));
            break;
        case "action bar":
            if (actionBarTasks.containsKey(player.getUniqueId())) {
                Bukkit.getScheduler().cancelTask(actionBarTasks.get(player.getUniqueId()));
            }
            actionBarTasks.put(player.getUniqueId(), Bukkit.getScheduler().scheduleSyncRepeatingTask(Cardinal.getInstance(), new Runnable() {

                private int tick;

                @Override
                public void run() {
                    if (tick > 40) {
                        if (actionBarTasks.containsKey(player.getUniqueId())) {
                            Bukkit.getScheduler().cancelTask(actionBarTasks.get(player.getUniqueId()));
                            actionBarTasks.remove(player.getUniqueId());
                        }
                    } else {
                        sendActionBarPacket(player, kills, deaths, kd);
                        tick++;
                    }
                }
            }, 1L, 1L));
            break;
    }
}
 
Example 20
Source File: MonumentModes.java    From CardinalPGM with MIT License 4 votes vote down vote up
public String toChatMessage() {
    String strike = hasRan() ? ChatColor.STRIKETHROUGH + "" : "";
    return ChatColor.GOLD + strike + "${index}. " + ChatColor.LIGHT_PURPLE + strike + name + " - " + ChatColor.AQUA
            + strike + Strings.formatTime(getTimeAfter()) + ChatColor.DARK_AQUA + strike +
            (GameHandler.getGameHandler().getMatch().isRunning() ? " (" + Strings.formatTime(Math.max(getTimeAfter() - MatchTimer.getTimeInSeconds(), 0)) + " left)" : "");
}