Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command never gets executed #403

Closed
RaphaelTarita opened this issue Aug 25, 2022 · 4 comments
Closed

Command never gets executed #403

RaphaelTarita opened this issue Aug 25, 2022 · 4 comments

Comments

@RaphaelTarita
Copy link

I am experiencing a problem that sounds very similar to #253, in fact, I originally did have the commands declared in my plugin.yml. I then removed them, but I still have the same problem.

Basically, the code looks like this:

// in onEnable
val test = Literal.of("test").executes { source, _ ->
     source.sendMessage("Hello, World!")
}.build()

dispatcher.root.addChild(test)
dispatcher.update()

The command is, in a way, registered, because it shows up in completion. However when I try to execute it, nothing happens. Log statements and debugging also confirmed that the executes lambda never gets executed. I've seen in other support questions (like #253) that people are also using annotation-based command registration. However, I'm trying to accomplish this with the plain brigadier / chimera builders only. Do I still need some basic annotation for it to work?

Version Data:

  • Paper 1.19.2 (API version 1.19)
  • OpenJDK 17 (compiled with target version 11)
  • karuslabs commons 5.4.1
  • brigadier 1.0.18
  • Kotlin/JVM 1.7.10
@Pante
Copy link
Owner

Pante commented Aug 25, 2022

Annotations aren't required since they're actually transpiled to builders internally. Can you try using 5.4.2-SNAPSHOT instead? If I remember correctly, this is a known issue in 5.4.1. In addition, ensure that the commands aren't registered in the plugin.yml as well. Changes to 1.19+ made commands not execute if they are also registered in the plugin.yml.

@RaphaelTarita
Copy link
Author

RaphaelTarita commented Aug 25, 2022

Thanks for the reply! Do I need a separate maven repository in order to pull 5.4.2-SNAPSHOT or is it on maven central as well? found it

Regarding the plugin.yml, I already removed all command definitions from it and double-checked that the final jar doesn't contain them either. I really wished that to be the solution, seemed so plausible

@Pante
Copy link
Owner

Pante commented Aug 25, 2022

Yup! It needs to be pulled from the snapshot repository,

<repository>
  <id>chimera-snapshots</id>
  <url>https://repo.karuslabs.com/repository/chimera-snapshots/</url>
</repository>

Ah, what I meant was that commands shouldn't be registered in the plugin.yml in addition to upgrading to 5.4.2-SNAPSHOT.

I'll probably deploy 5.4.2 tomorrow if upgrading to 5.4.2-SNAPSHOT works.

@RaphaelTarita
Copy link
Author

Thank you very much, it actually worked with the snapshot version! All my commands now execute properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants