At least have the decency of using utf8-codes 💥

This commit is contained in:
Sauilitired 2014-11-08 23:53:04 +01:00
parent 7e208afbe2
commit ee89e9cb2e
5 changed files with 9 additions and 6 deletions

View File

@ -38,7 +38,7 @@ public class Flag {
* @throws IllegalArgumentException if you provide inadequate inputs * @throws IllegalArgumentException if you provide inadequate inputs
*/ */
public Flag(final AbstractFlag key, final String value) { public Flag(final AbstractFlag key, final String value) {
final char[] allowedCharacters = new char[]{'[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', ':', '§'}; final char[] allowedCharacters = new char[]{'[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', ':', '\u00A7'};
String tempValue = value; String tempValue = value;
for (final char c : allowedCharacters) { for (final char c : allowedCharacters) {
tempValue = tempValue.replace(c, 'c'); tempValue = tempValue.replace(c, 'c');

View File

@ -246,10 +246,13 @@ public class PlayerFunctions {
String[] ss = ChatPaginator.wordWrap(msg, ChatPaginator.AVERAGE_CHAT_PAGE_WIDTH); String[] ss = ChatPaginator.wordWrap(msg, ChatPaginator.AVERAGE_CHAT_PAGE_WIDTH);
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
for (String p : ss) { for (String p : ss) {
b.append(p).append("\n "); b.append(p).append(p.equals(ss[ss.length - 1]) ? "" : "\n ");
} }
msg = b.toString(); msg = b.toString();
} }
if (msg.endsWith("\n")) {
msg = msg.substring(0, msg.length() - 2);
}
plr.sendMessage(msg); plr.sendMessage(msg);
} }

View File

@ -146,8 +146,8 @@ public class MainCommand implements CommandExecutor, TabCompleter {
} }
/* Let's try to get a proper usage string */ /* Let's try to get a proper usage string */
SubCommand command = (SubCommand) new StringComparsion(args[0], commands).getMatchObject(); String command = new StringComparsion(args[0], commands).getBestMatch();
return PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, command.usage.contains("plot") ? command.usage : "/plot " + command.usage); return PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
//PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new StringComparsion(args[0], commands).getBestMatch()); //PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new StringComparsion(args[0], commands).getBestMatch());
} }
} }

View File

@ -21,7 +21,7 @@ public class TranslationObject {
creationDescription = ""; creationDescription = "";
} }
for (char c : key.toCharArray()) { for (char c : key.toCharArray()) {
if (!Character.isDigit(c) && !Character.isAlphabetic(c) && c != '_' && c != '&' && c != '§' && c != ':') { if (!Character.isDigit(c) && !Character.isAlphabetic(c) && c != '_' && c != '&' && c != '\u00A7' && c != ':') {
throw new RuntimeException( throw new RuntimeException(
String.format("Translation: '%s' is invalid (Character: '%s') - Only alphanumeric + (\\, _, &, §, :) charcters are allowed", String.format("Translation: '%s' is invalid (Character: '%s') - Only alphanumeric + (\\, _, &, §, :) charcters are allowed",
key, c + "" key, c + ""

View File

@ -23,7 +23,7 @@ public class BukkitTranslation {
public static String convert(TranslationAsset asset) { public static String convert(TranslationAsset asset) {
// In some cases newline can screw stuff up, so I added a new character thing // In some cases newline can screw stuff up, so I added a new character thing
// &- = new line // &- = new line
return asset.getTranslated().replace("&-", "\n").replace('&', '§'); return asset.getTranslated().replace("&-", "\n").replace('&', '\u00A7');
} }
/** /**