File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
modules/RoyalCommands/src/main/java/org/royaldev/royalcommands/rcommands Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1212import org .royaldev .royalcommands .RUtils ;
1313import org .royaldev .royalcommands .RoyalCommands ;
1414
15+ import net .md_5 .bungee .api .chat .ClickEvent ;
16+ import net .md_5 .bungee .api .chat .TextComponent ;
17+
1518import java .util .ArrayList ;
1619import java .util .List ;
1720
@@ -98,7 +101,14 @@ public void showHelp(final CommandSender cs, final String label) {
98101 cs .sendMessage (sb .toString ());
99102 for (final SubCommand sc : this .subcommands ) {
100103 if (!this .isAuthorized (cs , sc )) continue ;
101- cs .sendMessage (" " + MessageColor .POSITIVE + "/" + label + " " + sc .getUsage ().replace ("<command>" , sc .getShortName ()));
104+ String cmdPrefix = "/" + label + " " + sc .getUsage ().replace ("<command>" , sc .getShortName ());
105+ TextComponent tt = new TextComponent (" " );
106+ TextComponent cmd = new TextComponent (cmdPrefix );
107+ cmd .setColor (MessageColor .POSITIVE .bc ());
108+ // cmd.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click to ")));
109+ cmd .setClickEvent (new ClickEvent (ClickEvent .Action .SUGGEST_COMMAND , cmdPrefix .split ("[\\ (\\ [\\ {]" )[0 ]));
110+ tt .addExtra (cmd );
111+ cs .spigot ().sendMessage (tt );
102112 cs .sendMessage (" " + MessageColor .NEUTRAL + sc .getDescription ());
103113 }
104114 }
You can’t perform that action at this time.
0 commit comments