Rollczi / LiteCommands

☄️ LiteCommands - Command framework for Velocity, Bukkit, Paper, BungeeCord, Minestom, Sponge, Fabric, JDA and future implementations.
https://docs.rollczi.dev/
Apache License 2.0
146 stars 21 forks source link

GH-230 Implement Sponge platform support #372

Closed BlackBaroness closed 9 months ago

BlackBaroness commented 9 months ago

Closes #230

Hi, sorry for being super late!

Here is a Sponge 8 support (it's the latest stable API, included in all modern Sponge builds).

I added a ServerPlayer argument, ServerPlayer contextual and test /tp <player> [player] command. You can test it yourself using ./gradlew :examples:sponge:runServer. I also wanted to add a /gm command, but Sponge has... special... API design and I couldn't understand how to make proper suggestions (but the parsing was relatively fine). However, I believe it's enough for this platform.

image


It's the newly opened version of my previous PR. Changes in this one:

  1. Based on newest master branch
  2. Register ServerPlayerArgument and ServerPlayerOnlyContextual automatically, just like in Bukkit platform
  3. Use MessageKey system to handle argument/contextual messages instead of using legacy contructor variant
  4. Make ServerPlayerOnlyContextual return ServerPlayer, not Player
Rollczi commented 9 months ago

@BlackBaroness Thanks for your pull request. I tested all changes and fixed a few issues. There is also a new example of kick command 😸. Check out the new changes and give me your feedback if everything is okay with my changes (I don't have any experiences with the sponge platform.

BlackBaroness commented 9 months ago

Check out the new changes and give me your feedback if everything is okay

Everything looks good (I don't use Sponge either btw)

Did you test it? I believe I had errors when LiteSpongeCommand and LiteSpongePlatform were not public, that's why I did it like that. Sponge tried to access these classes for some reason

Rollczi commented 9 months ago

Check out the new changes and give me your feedback if everything is okay

Everything looks good (I don't use Sponge either btw)

Did you test it? I believe I had errors when LiteSpongeCommand and LiteSpongePlatform were not public, that's why I did it like that. Sponge tried to access these classes for some reason

Yeah, you are right. Sponge does not support package-private classes :/. I will fix that.