diff --git a/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java b/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java index 7988a5d1e..33714f513 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java @@ -7,7 +7,38 @@ import org.bukkit.ChatColor; */ public class ConsoleColors { - public static final String ANSI_RESET = "\u001B[0m"; + static enum ConsoleColor { + RESET ("\u001B[0m"), + BLACK ("\u001B[30m"), + RED ("\u001B[31m"), + GREEN ("\u001B[32m"), + YELLOW ("\u001B[33m"), + BLUE ("\u001B[34m"), + PURPLE ("\u001B[35m"), + CYAN ("\u001B[36m"), + WHITE ("\u001B[37m"), + BOLD ("\033[1m"), + UNDERLINE ("\033[0m"), + ITALIC ("\033[3m"); + + private String win; + private String lin; + + ConsoleColor(String lin) { + this.lin = lin; + this.win = win; + } + + public String getWin() { + return win; + } + + public String getLin(){ + return lin; + } + } + + /* public static final String ANSI_RESET = "\u001B[0m"; public static final String ANSI_BLACK = "\u001B[30m"; public static final String ANSI_RED = "\u001B[31m"; public static final String ANSI_GREEN = "\u001B[32m"; @@ -18,49 +49,53 @@ public class ConsoleColors { public static final String ANSI_WHITE = "\u001B[37m"; public static final String ANSI_BOLD = "\033[1m"; public static final String ANSI_UNDERLINE = "\033[0m"; - public static final String ANSI_ITALIC = "\033[3m]"; + public static final String ANSI_ITALIC = "\033[3m]";*/ public static String fromString(String input) { input = input.replaceAll("&0", fromChatColor(ChatColor.BLACK)).replaceAll("&1", fromChatColor(ChatColor.DARK_BLUE)).replaceAll("&2", fromChatColor(ChatColor.DARK_GREEN)).replaceAll("&3", fromChatColor(ChatColor.DARK_AQUA)).replaceAll("&4", fromChatColor(ChatColor.DARK_RED)).replaceAll("&5", fromChatColor(ChatColor.DARK_PURPLE)).replaceAll("&6", fromChatColor(ChatColor.GOLD)).replaceAll("&7", fromChatColor(ChatColor.GRAY)).replaceAll("&8", fromChatColor(ChatColor.DARK_GRAY)).replaceAll("&9", fromChatColor(ChatColor.BLUE)).replaceAll("&a", fromChatColor(ChatColor.GREEN)).replaceAll("&b", fromChatColor(ChatColor.AQUA)).replaceAll("&c", fromChatColor(ChatColor.RED)).replaceAll("&d", fromChatColor(ChatColor.LIGHT_PURPLE)).replaceAll("&e", fromChatColor(ChatColor.YELLOW)).replaceAll("&f", fromChatColor(ChatColor.WHITE)).replaceAll("&k", fromChatColor(ChatColor.MAGIC)).replaceAll("&l", fromChatColor(ChatColor.BOLD)).replaceAll("&m", fromChatColor(ChatColor.STRIKETHROUGH)) .replaceAll("&n", fromChatColor(ChatColor.UNDERLINE)).replaceAll("&o", fromChatColor(ChatColor.ITALIC)).replaceAll("&r", fromChatColor(ChatColor.RESET)); - return input + ANSI_RESET; + return input + ConsoleColor.RESET.toString(); } public static String fromChatColor(ChatColor color) { + return chatColor(color).getLin(); + } + + public static ConsoleColor chatColor(ChatColor color) { switch (color) { case RESET: - return ANSI_RESET; + return ConsoleColor.RESET; case GRAY: case DARK_GRAY: - return ANSI_WHITE; + return ConsoleColor.WHITE; case BLACK: - return ANSI_BLACK; + return ConsoleColor.BLACK; case DARK_RED: case RED: - return ANSI_RED; + return ConsoleColor.RED; case GOLD: case YELLOW: - return ANSI_YELLOW; + return ConsoleColor.YELLOW; case DARK_GREEN: case GREEN: - return ANSI_GREEN; + return ConsoleColor.GREEN; case AQUA: case DARK_AQUA: - return ANSI_CYAN; + return ConsoleColor.CYAN; case LIGHT_PURPLE: case DARK_PURPLE: - return ANSI_PURPLE; + return ConsoleColor.PURPLE; case BLUE: case DARK_BLUE: - return ANSI_BLUE; + return ConsoleColor.BLUE; case UNDERLINE: - return ANSI_UNDERLINE; + return ConsoleColor.UNDERLINE; case ITALIC: - return ANSI_ITALIC; + return ConsoleColor.ITALIC; case BOLD: - return ANSI_BOLD; + return ConsoleColor.BOLD; default: - return ""; + return ConsoleColor.RESET; } } } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java index ce9d70571..a4b2920dd 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java @@ -9,18 +9,17 @@ package com.intellectualcrafters.plot.commands; -import java.util.ArrayList; -import java.util.Arrays; - +import com.intellectualcrafters.plot.C; +import com.intellectualcrafters.plot.PlayerFunctions; +import com.intellectualcrafters.plot.PlotMain; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import com.intellectualcrafters.plot.C; -import com.intellectualcrafters.plot.PlayerFunctions; -import com.intellectualcrafters.plot.PlotMain; +import java.util.ArrayList; +import java.util.Arrays; /** * PlotMain command class @@ -123,7 +122,7 @@ public class MainCommand implements CommandExecutor { if (cmd.permission.hasPermission(player) && (cmd.category == category)) { String s = t(C.HELP_PAGE.s()); s = s.replaceAll("%alias%", cmd.alias); - s = s.replaceAll("%usage%", "/plot " + cmd.usage); + s = s.replaceAll("%usage%", cmd.usage.contains("plot") ? cmd.usage : "/plot " + cmd.usage); s = s.replaceAll("%cmd%", cmd.cmd); s = s.replaceAll("%desc%", cmd.description); help.add(s);