sakura-ryoko / servux

A server-side Minecraft mod that sends data to and provides some other integration with masa's client-side mods
GNU Lesser General Public License v3.0
36 stars 2 forks source link

feat: servux setting #9

Closed zly2006 closed 2 months ago

zly2006 commented 2 months ago

@sakura-ryoko I ve made ServuxConfigProvider to the new settings system, how do you feel about it so far?

for the commands, I am supporting these formats: /servux set <setting name> <value> /servux set <provider name>:<setting name> <value>

sakura-ryoko commented 2 months ago

Interesting for sure.

zly2006 commented 2 months ago

OK I basically finished, could you please help improve the CLI and translations? I am still not sure how to do with the translations

sakura-ryoko commented 2 months ago

The main things that might need translations are the Descriptions such as: Text.of("The permission level required for the Litematics data provider")

zly2006 commented 2 months ago

The main things that might need translations are the Descriptions such as: Text.of("The permission level required for the Litematics data provider")

as well as in prettyName, they are both in Text type.

sakura-ryoko commented 2 months ago

I've added a translatable text system, based on the Vanilla Language code. It can be set via the servux.json with a new config setting, using the StringUtils.loadLangCode("en_us") method, for example.

More translation Strings can be added, and it would be best to add direct translation support via the ServuxConfig types.

So basically, the default Servux config would be "en_us" but then when the config file gets loaded with a new setting, then it can load the new lang file.

sakura-ryoko commented 2 months ago

And perhaps I wanted to ask your opinion on adding Text Parser / QuickText support to the mod?

I also helped port PlaceholderAPI, and provided to Pat Box the 1.21 port for it.

See: https://modrinth.com/mod/placeholder-api Mod Menu recently added it as a requirement for Mod Menu under 1.21 after I helped port Mod Menu.

I use it myself under my AFK mod, and it might not be required, but then we could do new and more fancy text formatting support. (Think like a text chat provider, sort of like Styled-Chat would even be possible) ... Although using the Vanilla Formatter codes are always compatible.

zly2006 commented 2 months ago

@sakura-ryoko I changed your i18n code, so it is reloadable, and can be overridden by client side resource packs.

sakura-ryoko commented 2 months ago

All good, it was mostly a clone of the vanilla Language class as a basis, and I figured that we would modify it to suit our needs on the server side.

zly2006 commented 2 months ago

I think it can be merged, please review the response texts and tell me your thoughts. btw should we make servux also able to load on clients, so the assets, including language files, can be loaded to clients if players installed the mod?

sakura-ryoko commented 2 months ago

I think it can be merged, please review the response texts and tell me your thoughts. btw should we make servux also able to load on clients, so the assets, including language files, can be loaded to clients if players installed the mod?

No client side. That is a conversation I had with Masa before, since it will only cause Network problems; because then MaLiLib needs to hold all of the Packet/Payload Classes, and Servux would need to depend upon it for the network API.

Yes, I had it like this under the 1.20.6 Snapshot code, like look at the '24w14potato' code; and MaLiLib had a more active role in managing the Data Channels.

This code was all removed due to complexity for downstream mods and I was simply attacked from multiple sides for it, but I did have it working; but working doesn't mean that is something that they wanted. It created a problem where people would then need to add all of their Packets into MaLiLib and that was not Downstream Mod Friendly. MaLiLib is only a Library Mod and should not have such an active role in managing all of it's dependent mods' network beyond the IPlugin Channel.

Back then MaLiLib was holding all of the server side interfaces as well, IPlayerManager, etc. And it had a (now removed) class called PayloadManager that would need to be used to do all of the packet registrations, and keep both Client and Server side code separated out into contexts... It was a complex system that was ripped out.

That was all done just because of trying to make Servux work in the Client / Open To LAN world without crashing the game due to Packet classes being duplicated.

So, the best way forward with all of that was to put Servux back in the server space only; and rip out all of the junk that was not required, and remove PayloadManager, along with the rest of the Mixin style code that I was using for networking.

zly2006 commented 2 months ago

OK so could you test and review the current command system? I think it is almost complete

sakura-ryoko commented 2 months ago

I'll have to test it later when I am not busy

sakura-ryoko commented 2 months ago

It's looking much better @zly2006 -- One thing that I would like to tackle yet is the formatting of the text for the 'info', 'search' and 'set' . I know the code that you are using is still new, but it's just a matter of clarity after people type the commands. I think there should be more colors and use of Bold / Underline to denote which settings are active; sort of like how Carpet does the formatting.

It doesn't need to 'copy' Carpet, of course not; but just as a reference to what I mean with their use of the Bold / Underline, and colors. To me, it currently looks a bit plain or confusing with how it is saying "Default values" and "Current Value", etc.

Also, the addition of those interfaces are for potential Downstream Mods in the future.

zly2006 commented 2 months ago

How does it look now?

sakura-ryoko commented 2 months ago

Much better, thank you.

sakura-ryoko commented 2 months ago

Anything left that you have or can it be merged ?

zly2006 commented 2 months ago

I think it is OK to merge.