Allow the open command to be executed from the help by clicking it

This commit is contained in:
GeorgH93 2018-06-16 18:55:10 +02:00
parent be6644b4d5
commit 0e83e76653
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 4 additions and 3 deletions

View File

@ -50,7 +50,7 @@ public CommandManager(Minepacks plugin)
backpackCommand.setExecutor(this);
backpackCommand.setTabCompleter(this);
helpFormat = plugin.getLanguage().getMessage("Commands.HelpFormat").replaceAll("\\{MainCommand\\}", "%1\\$s").replaceAll("\\{SubCommand\\}", "%2\\$s").replaceAll("\\{Parameters\\}", "%3\\$s").replaceAll("\\{Description\\}", "%4\\$s");
helpFormat = plugin.getLanguage().getMessage("Commands.HelpFormat").replaceAll("\\{MainCommand\\}", "%1\\$s").replaceAll("\\{SubCommand\\}", "%2\\$s").replaceAll("\\{Parameters\\}", "%3\\$s").replaceAll("\\{Description\\}", "%4\\$s").replaceAll("suggest_command", "%5\\$s");
// Setting the help format for the marry commands as well as the no permissions and not from console message
try
@ -128,7 +128,7 @@ public void sendHelp(CommandSender target, String mainCommandAlias, Collection<H
{
for(HelpData d : data)
{
helpFormat.send(target, mainCommandAlias, d.getTranslatedSubCommand(), d.getParameter(), d.getDescription());
helpFormat.send(target, mainCommandAlias, d.getTranslatedSubCommand(), d.getParameter(), d.getDescription(), d.getClickAction().name().toLowerCase());
}
}
}

View File

@ -20,6 +20,7 @@
import at.pcgamingfreaks.Bukkit.Message.Message;
import at.pcgamingfreaks.Calendar.TimeSpan;
import at.pcgamingfreaks.Command.HelpData;
import at.pcgamingfreaks.Message.MessageClickEvent;
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
@ -121,7 +122,7 @@ public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull S
public List<HelpData> getHelp(@NotNull CommandSender requester)
{
List<HelpData> help = new LinkedList<>();
help.add(new HelpData("", null, getDescription()));
help.add(new HelpData("", null, getDescription(), MessageClickEvent.ClickEventAction.RUN_COMMAND));
if(requester.hasPermission("backpack.open.other"))
{
//noinspection ConstantConditions