mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
I hope this works...
This commit is contained in:
parent
8315121d66
commit
1ddb6b3bdc
@ -7,7 +7,38 @@ import org.bukkit.ChatColor;
|
|||||||
*/
|
*/
|
||||||
public class ConsoleColors {
|
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_BLACK = "\u001B[30m";
|
||||||
public static final String ANSI_RED = "\u001B[31m";
|
public static final String ANSI_RED = "\u001B[31m";
|
||||||
public static final String ANSI_GREEN = "\u001B[32m";
|
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_WHITE = "\u001B[37m";
|
||||||
public static final String ANSI_BOLD = "\033[1m";
|
public static final String ANSI_BOLD = "\033[1m";
|
||||||
public static final String ANSI_UNDERLINE = "\033[0m";
|
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) {
|
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))
|
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));
|
.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) {
|
public static String fromChatColor(ChatColor color) {
|
||||||
|
return chatColor(color).getLin();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConsoleColor chatColor(ChatColor color) {
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case RESET:
|
case RESET:
|
||||||
return ANSI_RESET;
|
return ConsoleColor.RESET;
|
||||||
case GRAY:
|
case GRAY:
|
||||||
case DARK_GRAY:
|
case DARK_GRAY:
|
||||||
return ANSI_WHITE;
|
return ConsoleColor.WHITE;
|
||||||
case BLACK:
|
case BLACK:
|
||||||
return ANSI_BLACK;
|
return ConsoleColor.BLACK;
|
||||||
case DARK_RED:
|
case DARK_RED:
|
||||||
case RED:
|
case RED:
|
||||||
return ANSI_RED;
|
return ConsoleColor.RED;
|
||||||
case GOLD:
|
case GOLD:
|
||||||
case YELLOW:
|
case YELLOW:
|
||||||
return ANSI_YELLOW;
|
return ConsoleColor.YELLOW;
|
||||||
case DARK_GREEN:
|
case DARK_GREEN:
|
||||||
case GREEN:
|
case GREEN:
|
||||||
return ANSI_GREEN;
|
return ConsoleColor.GREEN;
|
||||||
case AQUA:
|
case AQUA:
|
||||||
case DARK_AQUA:
|
case DARK_AQUA:
|
||||||
return ANSI_CYAN;
|
return ConsoleColor.CYAN;
|
||||||
case LIGHT_PURPLE:
|
case LIGHT_PURPLE:
|
||||||
case DARK_PURPLE:
|
case DARK_PURPLE:
|
||||||
return ANSI_PURPLE;
|
return ConsoleColor.PURPLE;
|
||||||
case BLUE:
|
case BLUE:
|
||||||
case DARK_BLUE:
|
case DARK_BLUE:
|
||||||
return ANSI_BLUE;
|
return ConsoleColor.BLUE;
|
||||||
case UNDERLINE:
|
case UNDERLINE:
|
||||||
return ANSI_UNDERLINE;
|
return ConsoleColor.UNDERLINE;
|
||||||
case ITALIC:
|
case ITALIC:
|
||||||
return ANSI_ITALIC;
|
return ConsoleColor.ITALIC;
|
||||||
case BOLD:
|
case BOLD:
|
||||||
return ANSI_BOLD;
|
return ConsoleColor.BOLD;
|
||||||
default:
|
default:
|
||||||
return "";
|
return ConsoleColor.RESET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,17 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.C;
|
||||||
import java.util.Arrays;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import java.util.Arrays;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotMain command class
|
* PlotMain command class
|
||||||
@ -123,7 +122,7 @@ public class MainCommand implements CommandExecutor {
|
|||||||
if (cmd.permission.hasPermission(player) && (cmd.category == category)) {
|
if (cmd.permission.hasPermission(player) && (cmd.category == category)) {
|
||||||
String s = t(C.HELP_PAGE.s());
|
String s = t(C.HELP_PAGE.s());
|
||||||
s = s.replaceAll("%alias%", cmd.alias);
|
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("%cmd%", cmd.cmd);
|
||||||
s = s.replaceAll("%desc%", cmd.description);
|
s = s.replaceAll("%desc%", cmd.description);
|
||||||
help.add(s);
|
help.add(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user