From ee89e9cb2efbce3bf61bf871dc584537f2769aca Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Sat, 8 Nov 2014 23:53:04 +0100 Subject: [PATCH] At least have the decency of using utf8-codes :boom: --- .../src/main/java/com/intellectualcrafters/plot/Flag.java | 2 +- .../java/com/intellectualcrafters/plot/PlayerFunctions.java | 5 ++++- .../com/intellectualcrafters/plot/commands/MainCommand.java | 4 ++-- .../com/intellectualsites/translation/TranslationObject.java | 2 +- .../translation/bukkit/BukkitTranslation.java | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java index 1c60818fd..56c673cbf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java @@ -38,7 +38,7 @@ public class Flag { * @throws IllegalArgumentException if you provide inadequate inputs */ public Flag(final AbstractFlag key, final String value) { - final char[] allowedCharacters = new char[]{'[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', ':', '§'}; + final char[] allowedCharacters = new char[]{'[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', ':', '\u00A7'}; String tempValue = value; for (final char c : allowedCharacters) { tempValue = tempValue.replace(c, 'c'); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlayerFunctions.java index 597f736be..b695bcc62 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlayerFunctions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlayerFunctions.java @@ -246,10 +246,13 @@ public class PlayerFunctions { String[] ss = ChatPaginator.wordWrap(msg, ChatPaginator.AVERAGE_CHAT_PAGE_WIDTH); StringBuilder b = new StringBuilder(); for (String p : ss) { - b.append(p).append("\n "); + b.append(p).append(p.equals(ss[ss.length - 1]) ? "" : "\n "); } msg = b.toString(); } + if (msg.endsWith("\n")) { + msg = msg.substring(0, msg.length() - 2); + } plr.sendMessage(msg); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index 3c5eb4b0c..524a8a0b0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -146,8 +146,8 @@ public class MainCommand implements CommandExecutor, TabCompleter { } /* Let's try to get a proper usage string */ - SubCommand command = (SubCommand) new StringComparsion(args[0], commands).getMatchObject(); - return PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, command.usage.contains("plot") ? command.usage : "/plot " + command.usage); + String command = new StringComparsion(args[0], commands).getBestMatch(); + return PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command); //PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new StringComparsion(args[0], commands).getBestMatch()); } } diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java b/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java index a5caea172..ae396b03d 100644 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java +++ b/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java @@ -21,7 +21,7 @@ public class TranslationObject { creationDescription = ""; } 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( String.format("Translation: '%s' is invalid (Character: '%s') - Only alphanumeric + (\\, _, &, §, :) charcters are allowed", key, c + "" diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java b/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java index 031c13bbf..1221173b4 100644 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java +++ b/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java @@ -23,7 +23,7 @@ public class BukkitTranslation { public static String convert(TranslationAsset asset) { // In some cases newline can screw stuff up, so I added a new character thing // &- = new line - return asset.getTranslated().replace("&-", "\n").replace('&', '§'); + return asset.getTranslated().replace("&-", "\n").replace('&', '\u00A7'); } /**