geforkt von Mirrors/Paper
[Bleeding] Fixed a StackOverflowError with command alias handling for Help. Addresses BUKKIT-1253
Dieser Commit ist enthalten in:
Ursprung
8aee4c3f56
Commit
31b1bc02ca
@ -1,5 +1,6 @@
|
|||||||
package org.bukkit.craftbukkit.help;
|
package org.bukkit.craftbukkit.help;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.help.HelpMap;
|
import org.bukkit.help.HelpMap;
|
||||||
@ -14,6 +15,7 @@ public class CommandAliasHelpTopic extends HelpTopic {
|
|||||||
this.aliasFor = aliasFor.startsWith("/") ? aliasFor : "/" + aliasFor;
|
this.aliasFor = aliasFor.startsWith("/") ? aliasFor : "/" + aliasFor;
|
||||||
this.helpMap = helpMap;
|
this.helpMap = helpMap;
|
||||||
this.name = alias.startsWith("/") ? alias : "/" + alias;
|
this.name = alias.startsWith("/") ? alias : "/" + alias;
|
||||||
|
Validate.isTrue(!this.name.equals(this.aliasFor), "Command " + this.name + " cannot be alias for itself");
|
||||||
this.shortText = ChatColor.YELLOW + "Alias for " + ChatColor.WHITE + this.aliasFor;
|
this.shortText = ChatColor.YELLOW + "Alias for " + ChatColor.WHITE + this.aliasFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,9 @@ public class SimpleHelpMap implements HelpMap {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (String alias : command.getAliases()) {
|
for (String alias : command.getAliases()) {
|
||||||
addTopic(new CommandAliasHelpTopic(alias, command.getLabel(), this));
|
if (!helpTopics.containsKey("/" + alias)) {
|
||||||
|
addTopic(new CommandAliasHelpTopic("/" + alias, "/" + command.getLabel(), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren