univrsal / JustEnoughButtons

Adds utility buttons to the inventory screen
Mozilla Public License 2.0
6 stars 5 forks source link

Support SpongeForge #15

Closed TheRandomLabs closed 7 years ago

TheRandomLabs commented 7 years ago

A lot of Sponge plugins change vanilla command behavior, but it might be possible to check if SpongeForge is installed on the server, and if so, tack "minecraft:" onto the start of the commands JEB executes.

univrsal commented 7 years ago

Do you mean that for example the comand "/gamemode 1" would turn into "minecraft:/gamemode 1"? I have never used Sponge or SpongeForge so I'm kinda clueless about what you mean

TheRandomLabs commented 7 years ago

No, it would turn into /minecraft:gamemode 1. For example, virtually no Sponge plugins allow entity selectors in their commands. I'm not sure how to check if SpongeForge is installed on the server-side though...

univrsal commented 7 years ago

Well, from what I understood SpongeForge is a normal Forge mod so checking if it's installed shouldn't be too hard. I'll see what I can do

TheRandomLabs commented 7 years ago

But JEB is client-sided and SpongeForge is server-sided, and SpongeForge is usually installed in a different instance of the game to the client. Maybe if you can't detect SpongeForge directly, you could instead check if the command is throwing a CommandException (or something similar), and if so, then change the command and try again.

univrsal commented 7 years ago

The mod is intended to work without being installed on the server, but it can be installed on the server to improve the experience (Which would allow me to check on the server side and then send a message to the client if Sponge is installed). But as far as I know there's an event when joining the server which sends the mod list so I should be able to check over that event whether Sponge is installed.

TheRandomLabs commented 7 years ago

Okay. Thanks for looking into this issue.

univrsal commented 7 years ago

So this turned out harder than I thought. I added a config option which lets you add a server ip, so Just Enough buttons knows when it joins that server, that it is running sponge.

While testing this I found out that even though sponge was installed the commands ran just fine without the /minecraft: prefix. Which minecraft version are you using?

TheRandomLabs commented 7 years ago

Sponge itself doesn't change the command behavior, but plugins tend to, e.g. Nucleus.

univrsal commented 7 years ago

So for now I'll leave it at the config option since I haven't found any other good way. It's included in the next release

TheRandomLabs commented 7 years ago

Just out of curiosity, what kept you from being able to send a message from the server to the client?

univrsal commented 7 years ago

Well originally the idea was to request a modlist from the server and I didn't figure that out. Now if JEB is installed on the server it'll send a message to the client wether or not sponge is installed. But that obviously only works when it's installed on the server and the idea was to kinda keep it client-side :P So now there's the config option for when the server doesn't have JEB and the message for when it does.