mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
[Bleeding] Fixed a StackOverflowError with command alias handling for Help. Addresses BUKKIT-1253
By: zml2008 <zach@zachsthings.com>
This commit is contained in:
parent
d434857d8a
commit
2a1f1b1008
2 changed files with 13 additions and 9 deletions
|
@ -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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue