TextActions.runCommand troubles

So I’m designing a utility for displaying command help, and it uses an internal command to link the player to other command pages. The command works, and the pagination and all that works. The problem I’m having is when I click text with TextActions.runCommand applied, it chats the text (as me) in the color of what I clicked on, and underlined. I’d rather not post an example of my code, because it links to various other utilities I’m also using, for example I have my own TextBuilder (backed by an actual TextBuilder) to simplify interaction with another utility of my API. If you really want to see the code, the error occurs here and here. There is the possibility that the fault is in the MessageBuilder class, but I doubt it, since most of the methods there delegate directly to the backing TextBuilder.

Here is a screenshot of the behavior:

The very top section of text is the list of commands, the second chat (as me) is the result of clicking the text, and the final chunk of text is the result of actually running the command

While I can’t work out the reason your code isn’t working, it looks like you might be better suited to use a ClickAction.ExecuteCallback instead.

You could then make your InternalHelpCommand (which, by definition, does not need to be user accessible) a Consumer, pass in variables, and execute that on click instead.

It’s a different way to approach the problem, but makes more sense in my head than passing it through another command.

1 Like

Maybe you need to put a / at the start of the runCommand strings?

I’ve never had this problem and I’ve used click events quite a lot. I think @JBYoshi might be on to something though, I’ve always included / when using runCommand. I also agree with @ZephireNZ. No need to be registering commands that are only being used for click events.

@ZephireNZ
Didn’t realize that was a thing… xD
Will probably do that.

@JBYoshi
I think that is the problem, I guess assuming that the runCommand action runs a command was too much.