13
0
geforkt von Mirrors/Paper

[Bleeding] Implement escape sequence for aliases.

By: t00thpick1 <t00thpick1dirko@gmail.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2014-02-09 19:25:27 -05:00
Ursprung aecd846814
Commit 6da9e19042

Datei anzeigen

@ -65,6 +65,12 @@ public class FormattedCommandAlias extends Command {
while (index != -1) {
int start = index;
if (index > 0 && formatString.charAt(start - 1) == '\\') {
formatString = formatString.substring(0, start - 1) + formatString.substring(start);
index = formatString.indexOf("$", index);
continue;
}
boolean required = false;
if (formatString.charAt(index + 1) == '$') {
required = true;
@ -74,10 +80,16 @@ public class FormattedCommandAlias extends Command {
// Move index past the $
index++;
int position = Character.getNumericValue(formatString.charAt(index)) - 1;
int position = Character.getNumericValue(formatString.charAt(index));
// Move index past the position
index++;
if (position == -1) {
throw new IllegalArgumentException("Invalid replacement token");
}
// Convert position to 0 index
position--;
boolean rest = false;
if (index < formatString.length() && formatString.charAt(index) == '-') {
rest = true;