finally add usage to help's hoverevent
piece of shit
This commit is contained in:
parent
c430cd894d
commit
c26c1603ac
1 changed files with 14 additions and 1 deletions
|
@ -5,6 +5,7 @@ import land.chipmunk.chayapak.chomens_bot.command.Command;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.JoinConfiguration;
|
import net.kyori.adventure.text.JoinConfiguration;
|
||||||
|
import net.kyori.adventure.text.event.HoverEvent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -40,8 +41,11 @@ public class HelpCommand implements Command {
|
||||||
|
|
||||||
private Bot bot;
|
private Bot bot;
|
||||||
|
|
||||||
|
private CommandContext context;
|
||||||
|
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
this.bot = context.bot();
|
this.bot = context.bot();
|
||||||
|
this.context = context;
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
return sendCommandList();
|
return sendCommandList();
|
||||||
} else {
|
} else {
|
||||||
|
@ -83,7 +87,16 @@ public class HelpCommand implements Command {
|
||||||
Collections.sort(commandNames);
|
Collections.sort(commandNames);
|
||||||
|
|
||||||
for (String name : commandNames) {
|
for (String name : commandNames) {
|
||||||
list.add(Component.text(name).color(getColorByTrustLevel(trustLevel)));
|
list.add(
|
||||||
|
Component
|
||||||
|
.text(name)
|
||||||
|
.color(getColorByTrustLevel(trustLevel))
|
||||||
|
.hoverEvent(
|
||||||
|
HoverEvent.showText(
|
||||||
|
sendUsages(context, new String[] { name })
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
Loading…
Reference in a new issue