Java Code Examples for org.bukkit.ChatColor#WHITE

The following examples show how to use org.bukkit.ChatColor#WHITE . 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: ScoreboardManager.java    From UhcCore with GNU General Public License v3.0 6 votes vote down vote up
public String getScoreboardLine(int line){
    if (line == 0) return ChatColor.UNDERLINE + "" + ChatColor.RESET;
    if (line == 1) return ChatColor.ITALIC + "" + ChatColor.RESET;
    if (line == 2) return ChatColor.BOLD + "" + ChatColor.RESET;
    if (line == 3) return ChatColor.RESET + "" + ChatColor.RESET;
    if (line == 4) return ChatColor.GREEN + "" + ChatColor.RESET;
    if (line == 5) return ChatColor.DARK_GRAY + "" + ChatColor.RESET;
    if (line == 6) return ChatColor.GOLD + "" + ChatColor.RESET;
    if (line == 7) return ChatColor.RED + "" + ChatColor.RESET;
    if (line == 8) return ChatColor.YELLOW + "" + ChatColor.RESET;
    if (line == 9) return ChatColor.WHITE + "" + ChatColor.RESET;
    if (line == 10) return ChatColor.DARK_GREEN + "" + ChatColor.RESET;
    if (line == 11) return ChatColor.BLUE + "" + ChatColor.RESET;
    if (line == 12) return ChatColor.STRIKETHROUGH + "" + ChatColor.RESET;
    if (line == 13) return ChatColor.MAGIC + "" + ChatColor.RESET;
    if (line == 14) return ChatColor.DARK_RED + "" + ChatColor.RESET;
    return null;
}
 
Example 2
Source File: MultipleCommandAliasHelpTopic.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
public MultipleCommandAliasHelpTopic(MultipleCommandAlias alias) {
    this.alias = alias;

    name = "/" + alias.getLabel();

    // Build short text
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < alias.getCommands().length; i++) {
        if (i != 0) {
            sb.append(ChatColor.GOLD + " > " + ChatColor.WHITE);
        }
        sb.append("/");
        sb.append(alias.getCommands()[i].getLabel());
    }
    shortText = sb.toString();

    // Build full text
    fullText = ChatColor.GOLD + "Alias for: " + ChatColor.WHITE + getShortText();
}
 
Example 3
Source File: UltimateFancy.java    From UltimateChat with GNU General Public License v3.0 5 votes vote down vote up
private JSONArray addColorToArray(String text) {
    JSONArray extraArr = new JSONArray();
    ChatColor color = ChatColor.WHITE;
    for (String part : text.split("(?=" + ChatColor.COLOR_CHAR + "[0-9a-fA-Fk-oK-ORr])")) {
        JSONObject objExtraTxt = new JSONObject();
        Matcher match = Pattern.compile("^" + ChatColor.COLOR_CHAR + "([0-9a-fA-Fk-oK-ORr]).*$").matcher(part);
        if (match.find()) {
            color = ChatColor.getByChar(match.group(1).charAt(0));
            if (part.length() == 2) continue;
        }
        objExtraTxt.put("text", ChatColor.stripColor(part));
        if (color.isColor()) {
            objExtraTxt.put("color", color.name().toLowerCase());
            objExtraTxt.remove("obfuscated");
            objExtraTxt.remove("underlined");
            objExtraTxt.remove(ChatColor.STRIKETHROUGH.name().toLowerCase());
        }
        if (color.equals(ChatColor.RESET)) {
            objExtraTxt.put("color", "white");
            objExtraTxt.remove("obfuscated");
            objExtraTxt.remove("underlined");
            objExtraTxt.remove(ChatColor.STRIKETHROUGH.name().toLowerCase());
        }
        if (color.isFormat()) {
            if (color.equals(ChatColor.MAGIC)) {
                objExtraTxt.put("obfuscated", true);
            } else if (color.equals(ChatColor.UNDERLINE)) {
                objExtraTxt.put("underlined", true);
            } else {
                objExtraTxt.put(color.name().toLowerCase(), true);
            }
        }
        extraArr.add(objExtraTxt);
    }
    return extraArr;
}
 
Example 4
Source File: Returned.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public ChatColor getStatusColor(Party viewer) {
  if (this.flag.getDefinition().hasMultipleCarriers()) {
    return ChatColor.WHITE;
  } else {
    return super.getStatusColor(viewer);
  }
}
 
Example 5
Source File: MiscUtil.java    From CardinalPGM with MIT License 5 votes vote down vote up
public static ChatColor convertDyeColorToChatColor(DyeColor dye) {
    switch (dye) {
        case WHITE:
            return ChatColor.WHITE;
        case ORANGE:
            return ChatColor.GOLD;
        case MAGENTA:
            return ChatColor.LIGHT_PURPLE;
        case LIGHT_BLUE:
            return ChatColor.BLUE;
        case YELLOW:
            return ChatColor.YELLOW;
        case LIME:
            return ChatColor.GREEN;
        case PINK:
            return ChatColor.RED;
        case GRAY:
            return ChatColor.DARK_GRAY;
        case SILVER:
            return ChatColor.GRAY;
        case CYAN:
            return ChatColor.DARK_AQUA;
        case PURPLE:
            return ChatColor.DARK_PURPLE;
        case BLUE:
            return ChatColor.DARK_BLUE;
        case BROWN:
            return ChatColor.GOLD;
        case GREEN:
            return ChatColor.DARK_GREEN;
        case RED:
            return ChatColor.DARK_RED;
        case BLACK:
            return ChatColor.BLACK;
    }

    return ChatColor.WHITE;
}
 
Example 6
Source File: UltimateFancy.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
private JSONArray addColorToArray(String text) {
    JSONArray extraArr = new JSONArray();
    ChatColor color = ChatColor.WHITE;
    for (String part : text.split("(?=" + ChatColor.COLOR_CHAR + "[0-9a-fA-Fk-oK-ORr])")) {
        JSONObject objExtraTxt = new JSONObject();
        Matcher match = Pattern.compile("^" + ChatColor.COLOR_CHAR + "([0-9a-fA-Fk-oK-ORr]).*$").matcher(part);
        if (match.find()) {
            color = ChatColor.getByChar(match.group(1).charAt(0));
            if (part.length() == 2) continue;
        }
        objExtraTxt.put("text", ChatColor.stripColor(part));
        if (color.isColor()) {
            objExtraTxt.put("color", color.name().toLowerCase());
            objExtraTxt.remove("obfuscated");
            objExtraTxt.remove("underlined");
            objExtraTxt.remove(ChatColor.STRIKETHROUGH.name().toLowerCase());
        }
        if (color.equals(ChatColor.RESET)) {
            objExtraTxt.put("color", "white");
            objExtraTxt.remove("obfuscated");
            objExtraTxt.remove("underlined");
            objExtraTxt.remove(ChatColor.STRIKETHROUGH.name().toLowerCase());
        }
        if (color.isFormat()) {
            if (color.equals(ChatColor.MAGIC)) {
                objExtraTxt.put("obfuscated", true);
            } else if (color.equals(ChatColor.UNDERLINE)) {
                objExtraTxt.put("underlined", true);
            } else {
                objExtraTxt.put(color.name().toLowerCase(), true);
            }
        }
        extraArr.add(objExtraTxt);
    }
    return extraArr;
}
 
Example 7
Source File: PluginNameConversationPrefix.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public PluginNameConversationPrefix(Plugin plugin, String separator, ChatColor prefixColor) {
    this.separator = separator;
    this.prefixColor = prefixColor;
    this.plugin = plugin;

    cachedPrefix = prefixColor + plugin.getDescription().getName() + separator + ChatColor.WHITE;
}
 
Example 8
Source File: CommandAliasHelpTopic.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public CommandAliasHelpTopic(String alias, String aliasFor, HelpMap helpMap) {
    this.aliasFor = aliasFor.startsWith("/") ? aliasFor : "/" + aliasFor;
    this.helpMap = helpMap;
    this.name = alias.startsWith("/") ? alias : "/" + alias;
    Validate.isTrue(!this.name.equals(this.aliasFor), "Command " + this.name + " cannot be alias for itself");
    this.shortText = ChatColor.YELLOW + "Alias for " + ChatColor.WHITE + this.aliasFor;
}
 
Example 9
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 10
Source File: MiscUtil.java    From CardinalPGM with MIT License 5 votes vote down vote up
public static ChatColor convertBannerColorToChatColor(DyeColor dye) {
    switch (dye) {
        case WHITE:
            return ChatColor.WHITE;
        case ORANGE:
            return ChatColor.GOLD;
        case MAGENTA:
            return ChatColor.LIGHT_PURPLE;
        case LIGHT_BLUE:
            return ChatColor.BLUE;
        case YELLOW:
            return ChatColor.YELLOW;
        case LIME:
            return ChatColor.GREEN;
        case PINK:
            return ChatColor.RED;
        case GRAY:
            return ChatColor.DARK_GRAY;
        case SILVER:
            return ChatColor.GRAY;
        case CYAN:
            return ChatColor.DARK_AQUA;
        case PURPLE:
            return ChatColor.DARK_PURPLE;
        case BLUE:
            return ChatColor.BLUE;
        case BROWN:
            return ChatColor.GOLD;
        case GREEN:
            return ChatColor.DARK_GREEN;
        case RED:
            return ChatColor.DARK_RED;
        case BLACK:
            return ChatColor.BLACK;
    }

    return ChatColor.WHITE;
}
 
Example 11
Source File: DestroyableCommands.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
private String formatProperty(String name, Object value) {
    return "  " + ChatColor.GRAY + name + ChatColor.DARK_GRAY + ": " + ChatColor.WHITE + value;
}
 
Example 12
Source File: ChatWriter.java    From BedwarsRel with GNU General Public License v3.0 4 votes vote down vote up
public static String pluginMessage(String str) {
  return ChatColor.translateAlternateColorCodes('&',
      BedwarsRel.getInstance().getConfig().getString("chat-prefix",
          ChatColor.GRAY + "[" + ChatColor.AQUA + "BedWars" + ChatColor.GRAY + "]"))
      + " " + ChatColor.WHITE + str;
}
 
Example 13
Source File: CreateTutorial.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 14
Source File: GunYMLLoader.java    From QualityArmory with GNU General Public License v3.0 4 votes vote down vote up
public static void loadAmmo(QAMain main) {

		if (new File(main.getDataFolder(), "ammo").exists()) {
			int items = 0;
			for (File f : new File(main.getDataFolder(), "ammo").listFiles()) {
				try {
					if (f.getName().contains("yml")) {
						FileConfiguration f2 = YamlConfiguration.loadConfiguration(f);
						if ((!f2.contains("invalid")) || !f2.getBoolean("invalid")) {
							Material m = f2.contains("material") ? Material.matchMaterial(f2.getString("material"))
									: Material.DIAMOND_AXE;
							int variant = f2.contains("variant") ? f2.getInt("variant") : 0;
							final String name = f2.getString("name");
							if(QAMain.verboseLoadingLogging)
							main.getLogger().info("-Loading AmmoType: " + name);

							String extraData = null;
							if (f2.contains("skull_owner")) {
								extraData = f2.getString("skull_owner");
							}
							String ed2 = null;
							if (f2.contains("skull_owner_custom_url")
									&& !f2.getString("skull_owner_custom_url").equals(Ammo.NO_SKIN_STRING)) {
								ed2 = f2.getString("skull_owner_custom_url");
							}

							final MaterialStorage ms = MaterialStorage.getMS(m, f2.getInt("id"), variant, extraData,
									ed2);
							final ItemStack[] materails = main
									.convertIngredients(f2.getStringList("craftingRequirements"));
							final String displayname = f2.contains("displayname")
									? ChatColor.translateAlternateColorCodes('&', f2.getString("displayname"))
									: (ChatColor.WHITE + name);
							final List<String> extraLore2 = f2.contains("lore") ? f2.getStringList("lore") : null;
							final List<String> extraLore = new ArrayList<String>();
							try {
								for (String lore : extraLore2) {
									extraLore.add(ChatColor.translateAlternateColorCodes('&', lore));
								}
							} catch (Error | Exception re52) {
							}

							final double price = f2.contains("price") ? f2.getDouble("price") : 100;

							int amountA = f2.getInt("maxAmount");

							double piercing = f2.getDouble("piercingSeverity");

							Ammo da = new Ammo(name, displayname, extraLore, ms, amountA, false, 1, price, materails,
									piercing);

							da.setCustomLore(extraLore);

							QAMain.ammoRegister.put(ms, da);
							items++;

							if (extraData != null) {
								da.setSkullOwner(extraData);
							}
							if (ed2 != null) {
								da.setCustomSkin(ed2);
							}
							if (f2.contains("craftingReturnAmount")) {
								da.setCraftingReturn(f2.getInt("craftingReturnAmount"));
							}

						}
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			if(!QAMain.verboseLoadingLogging)
				main.getLogger().info("-Loaded "+items+" Ammo types.");


		}
	}
 
Example 15
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 16
Source File: PlayerStorage.java    From BedwarsRel with GNU General Public License v3.0 4 votes vote down vote up
public void clean() {

    PlayerInventory inv = this.player.getInventory();
    inv.setArmorContents(new ItemStack[4]);
    inv.setContents(new ItemStack[]{});

    this.player.setAllowFlight(false);
    this.player.setFlying(false);
    this.player.setExp(0.0F);
    this.player.setLevel(0);
    this.player.setSneaking(false);
    this.player.setSprinting(false);
    this.player.setFoodLevel(20);
    this.player.setSaturation(10);
    this.player.setExhaustion(0);
    this.player.setMaxHealth(20.0D);
    this.player.setHealth(20.0D);
    this.player.setFireTicks(0);

    boolean teamnameOnTab = BedwarsRel.getInstance().getBooleanConfig("teamname-on-tab", true);
    boolean overwriteNames = BedwarsRel.getInstance().getBooleanConfig("overwrite-names", false);

    String displayName = this.player.getDisplayName();
    String playerListName = this.player.getPlayerListName();

    if (overwriteNames || teamnameOnTab) {
      Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(this.player);
      if (game != null) {
        game.setPlayerGameMode(player);
        Team team = game.getPlayerTeam(this.player);

        if (overwriteNames) {
          if (team != null) {
            displayName = team.getChatColor() + ChatColor.stripColor(this.player.getName());
          } else {
            displayName = ChatColor.stripColor(this.player.getName());
          }
        }

        if (teamnameOnTab) {
          if (team != null) {
            playerListName = team.getChatColor() + team.getName() + ChatColor.WHITE + " | "
                + team.getChatColor() + ChatColor.stripColor(this.player.getDisplayName());
          } else {
            playerListName = ChatColor.stripColor(this.player.getDisplayName());
          }
        }

        BedwarsPlayerSetNameEvent playerSetNameEvent =
            new BedwarsPlayerSetNameEvent(team, displayName, playerListName, player);
        BedwarsRel.getInstance().getServer().getPluginManager().callEvent(playerSetNameEvent);

        if (!playerSetNameEvent.isCancelled()) {
          this.player.setDisplayName(playerSetNameEvent.getDisplayName());
          this.player.setPlayerListName(playerSetNameEvent.getPlayerListName());
        }
      }
    }

    if (this.player.isInsideVehicle()) {
      this.player.leaveVehicle();
    }

    for (PotionEffect e : this.player.getActivePotionEffects()) {
      this.player.removePotionEffect(e.getType());
    }

    this.player.updateInventory();
  }
 
Example 17
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 18
Source File: Post.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
public ChatColor getColor() {
  return this.owner == null ? ChatColor.WHITE : this.owner.get().getDefaultColor();
}
 
Example 19
Source File: UHPrompts.java    From KTP with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getPromptText(ConversationContext context) {
	return ChatColor.GRAY+"Entrez le nom du joueur à ajouter dans la team "+((ChatColor)context.getSessionData("color"))+context.getSessionData("nomTeam")+ChatColor.WHITE+".";
}
 
Example 20
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;
    }
}