-
Notifications
You must be signed in to change notification settings - Fork 14
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
Split Treasury's code into modules #45
Conversation
api/src/main/java/me/lokka30/treasury/api/economy/misc/APIUtils.java
Outdated
Show resolved
Hide resolved
I've checked the code and since the migration logic is the same, it only changes the trigger that starts it, for example the trigger for bukkit/spigot/paper is a bukkit command but for other servers with their own command system the trigger would be their own command; the migration logic could be in the core module. |
As I said, this is not a completed pull request. Stuff which can be abstracted are yet to be abstracted. Some general API stuff will probably need to be changed. It is not complete so please do not do any reviews, only suggest stuff to be abstracted. |
I think that it might be better to split the modules over multiple repos, but that may also be annoying for others |
Most repos I see have them all in one place being childs of a common parent. |
No. The reason why they're called modules is that you contain them at 1 place on the internet. |
Then we will run into issues with forge + fabric should we ever choose to support them. It takes ages to compile those |
Why should we support fabric/forge? Either way they're hassle and if we do so we'd have to switch to using gradle |
Because we fully can. I also believe that having a cross-plattform economy API for once would help immensely. |
In that case we'd need to migrate to gradle, which is a hassle for multiple modules and lots of other things. But we need @lokka30 on that. Fairly sure we don't need fabric/forge support and gradle. |
Yeah, right now it is not that good to have that support; was just throwing the idea around |
I haven't really seen mods with an economy system thing or that needs an economy provider, they all normally just add the items that they need and not depend on anything else, and if supporting them means switching to Gradle it may be a little to much for so little, I can't think of mods that need an economy interface but I'm not really into mods. It may make more sense to support servers that allow the usage of mods and plugins |
Mods are to add stuff which vanilla minecraft can't offer or to optimize minecraft's internals. They're not used for such simple additions. |
|
This is not necesarily only for forge/fabric support. Instead of a parent project and multiple modules we would just have multiple modules that depend on each other
The only benefit I see with gradle instead of maven is compile time, but lets be real does it take that much time to compile anyways? If I'm not mistaken Gradle has more bugs, less repositoryes and there are easy ways to use a maven repo on a gradle project but not otherways (may be wrong here). Gradle also tends to be harder to use |
Wouldn't the API be a parent module? I still don't see any reason to split Treasury into multiple repositories - surely, the project's code can't become large enough to justify that? Edit: Accidentally had 'multiple modules' posted for a few seconds. Hope nobody saw that. 😄
Compile time is a very minor developer luxury - although Maven takes a few seconds longer than I think it should, it's really far from enough to justify moving to Gradle. I assume more people know how to use Maven than Gradle as well. |
Gradle doesn't have their own repository schema. They use maven's repositories. Benefits of gradle are compile time and that you can make custom actions when compiling - say to validate something (maven can also validate stuff via the plugins, but is kinda limited, so dont make it a solid plus). Also gradle has a lot of plugins and you can make your own plugins for it. Unfortunately, gradle is kind of a hassle when it comes to deploying to a maven repo (it can, but it is buggy), having multiple modules with it is also not really a go-to. We're sticking to maven as it is easy to use. |
needs a lot of refactoring but the thing stuff is getting moved shows that it will be core handled rather than handled plugin specifically
From my experience gradle has been far easier for deployment than maven as latter does not create the checksums. But I am also using a highly unusual publishing system where I push to mavenLocal first and then manually copy them over to the webserver |
I think we've decided about what build system we will use. End of discussion maven vs gradle. Now you may want to check out the newest changes and suggest things on the put |
Can you explain a little your thought process? |
I'm aiming to abstract as much as it can be abstracted into the core module so it is easier to implement treasury on different platforms. There's a lot to do in here ; I plan to document every part of that core module so it is
Plan is the following:
Some stuff have been implemented or is being worked on, I may create a table on the opening comment to track progress. |
Do we really need to implement them? The bukkit version of the plugin will check on spigotmc but the paper one may check on papermc and so on. Update checker probably can be on the core module of each platform
I dont understand what you mean here. So in bukkit we have the service provider that would allow to get the economy provider but in other platforms there may not be one so we give the responsability of providing the provider to a new provider? It may make sense to, before doing mayor changes to the code, discuss what needs to be on what module and what do we need to abstract |
Yes. If we do it per platform then we will have lots of duplicated code, which is something you don't want.
No. See the commands and the other parts of the code use the |
If we add more platforms for Treasury, go ahead, I really don't mind :)
What if we made our own service provider class, so it can be used universally? |
I mean, not that we can't, the thing is that we don't really need it. Sure, we'd remove that provider from the core module, but at the cost of maintaining a singleton API. |
If we're gonna talk speed ; I've just made a simple benchmark of AnnotationConfig if anyone's interested in the numbers. https://gist.github.com/MrIvanPlays/85d248a0e8ab15b71f45106e5359420d |
Please could you show an example of accessing keys in a YAML file? |
wdym? AnnotationConfig loads the config entries into the object you dump. private String foo = "bar"; will generate foo: "bar" and if the user changes it to foo: "baz" it's gonna be the same as: private String foo = "baz"; so you just access the field with a getter. |
It's the way you do config normally. BukkitConfiguration is just the worst way of doing config. |
Oh, I apologize, I must have had a brainfart whilst asking that question.. Thanks. 😜 |
Do you have any thoughts of Ivan's use of AnnotationConfig in this PR? |
Is there any way we can automate the getters for these - perhaps Lombok? |
I don't really like lombok. I mean it is a cool library but it uses hacks. And also the fact a plugin for intellij is required so you can develop normally is just a no-go. |
I didn't know it required a plugin. A+I it is then 🙂 |
Not really required but if you don't have it you're basically screwed writing that methods manually. |
Regardless it's a developer luxury that can be avoided. I don't think there will be many additions to the config files beyond what is currently there so I don't mind going the manual route - that is, IntelliJ's autocompletion. |
Lombok will result in the plugin being inaccessible for a lot of potential contributors - avoid it's use whenever possible |
The only thing I remark ist that the PR should be split.
3k LOC aren't well reviewable for me. |
Nono @yannicklamprecht he asks whether or not you approve to replace the homebrew config ( which currently sucks ) with AnnotationConfig. |
From the frontend standpoint I'm fine with that new config design. |
I think that the codemc deployment profile should not be done by me so it is gonna be left as a TODO. Waiting for your 2 cents on the code :) |
Suggestion 1: Suggestion 2: Suggestion 3: Suggestion 4: Suggestion 5: Suggestion 6: |
The best method is what it's currently using as it is guaranteed the craftbukkit package is gonna contain the version. No, materials are the worst way to check the versions because they're subject of a rapid change between releases.
Maven does not handle class filtering unless you have a maven plugin in the build and put the classes you need filtered in a special directory (a.ka |
Is this PR ready to be merged? |
@Jikoo, do you have any comments? I understand you are likely busy so don't worry about it if you can't. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually prefer using dependencyManagement
and pluginManagement
to properties for versioning in multi-module configurations, but it works fine and I'm okay with the current state. The restructure seems good, formatting is solid.
I apologize that I haven't looked at any of the configuration details, I spent most of my programming time recently prepping for 1.18.
If no one has anything else to say then yes. |
Merged - thank you very much Ivan and also to everyone who provided feedback on the PR! |
Intends to close #42