-
Notifications
You must be signed in to change notification settings - Fork 18
Reworked WorldEvents, implemented GUI Framework & Code Modernizations #45
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
base: master
Are you sure you want to change the base?
Conversation
|
I talked to Manu about this in discord but saying in the git thread as well. This PR should have its commits cleaned up before merging because there are a lot of repeat commits in here and many spots where things should be squashed so the git history doesn't become messy or hard to read. Otherwise if this gets merged it should just get squashed into 1 commit but I think given the number of changes here...for tracking purposes this should just get cleaned up so we arent getting 82 commits in upstream of varying redundancy. Cleaning this up will help people in the future so they are able to follow where certain changes were made (if something needs reverted we could easily locate the commit or two of origin as opposed to it being scattered over 20). Going to try to meet with Manu to help them with this. |
|
I think ideally in the future these changes should be split into multiple PRs as I feel this PR contains a lot. The implementation of the GUI Framework could be 1 PR and the "Code Modernization" I think should have been separate. These in a way are two different featuresets and the modernization in particular involves modifying a lot of files so it's not super clean to track which changes were part of which featureset from a git pov. It's also two different topics to discuss, which I think warrants having 2 different PRs for things like this in the future. We can discuss the framework in 1 thread and the "modernization" efforts in another one. It's not super pressing I think for this but in theory if there was a lot of discussion happening in the PRs it could be messy in the future so figured it was a thought worth sharing. Also if the leveling stuff is being introduced here that might also be worth a diff PR as well. |
|
Can we rebase this branch on the latest in master? Just to get rid of the chunk of commits coming from d61be67 I also see there are a couple duplicate commits in here like 632284c and ac05736. I think we should try to avoid this happening and if worst case scenario it does we squash that into 1 commit. I know that functionally all your changes will get in all the same, but from a git standpoint it's really good practice to clean those up and try to keep a concise tree when you can. I think it's still good practice cause it keeps this repo clean and ensures accuracy when it comes to tracking changes and metrics in general. We should treat upstream master as the "prod" environment so to speak so if we can i think we should try to keep that clean. Ik either which way this will get squashed into 1 commit there to keep it clean but it's still important cause when that happens it becomes a little more difficult to track when certain changes happened. So ideally it doesn't have to be and we can cleanly follow the tree. (ik you've have in the past already) I'd definitely recommend asking in #git-support if you encounter issues cleaning up your branch or see weird things like duplicate commits. Just so this can get sorted out earlier. Anyways all in all I think the changes themselves that are happening are great and exciting stuffs. Mainly write all this just to help out so they can be even better haha. |
…clearer dependency injection Gui update, `plugin` is now also a param for WorldEventScheduler for clearer dependency injection
…hion, new Util class ItemUtil to create items easily
…o Record (not sure if permanently or temporarily)
|
I think commit history should now be cleaner and PR should be mergeable, if @CrashCringle12 thinks so too |
|
@Manu585 thanks for handling that yeah this is MUCH better haha. The last thing is just checking out my reviews on some of the changes, you can comment on each one and mark it as resolved after you've made the suggested change or if whatever I proposed doesn't work/make sense. It'll also automatically mark my reviews as Outdated if you've made a change related to the highlighted code before you resolve it. |
src/main/java/com/projectkorra/rpg/modules/leveling/manager/RpgPlayerManager.java
Show resolved
Hide resolved
src/main/java/com/projectkorra/rpg/modules/randomavatar/avatar/Avatar.java
Outdated
Show resolved
Hide resolved
src/main/java/com/projectkorra/rpg/modules/randomavatar/avatar/AvatarManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/projectkorra/rpg/modules/randomavatar/avatar/Avatar.java
Outdated
Show resolved
Hide resolved
…ed` interface for WorldEvents. Introduced new Display interface `ITickingDisplay`, removed redundant WorldEventBossBar since we switch to wrapping the KeyedBossBar into the Display
…player quit / world changes for BossBar display in WorldEvents
WorldEvent class now only is State Introduced WorldEventManager to handle CRUD and State Removed past Schedule, needs to be re-done in a better way Moved classes into different packages for better overlook Introduced `AttributeRules` and `ScheduleParser` Objects to not use `FileConfiguration` in `WorldEvent` Object Handled world changes, server quits / joins for BossBar displays (ViewerDisplay) Re-did Attribute Ruleset and Modification Services
…stop. Fixed passive attribute recalculations
Removed WorldEventRuntime and created ActiveWorldEvent Object ActiveWorldEvents are being ticked by the newly introduced WorldEventService Introduced WorldEventRegistry and ActiveWorldEventIndex for storing and retrieving WorldEvents and ActiveWorldEvents Some GPT generated content included (toString() Debugging, Parts of Service)
Remove ViewerDisplay and TickingDisplay to introduce new IBossBarDisplay Introduced ChatDisplay, not yet in use but will be from benefit when players freshly join WorldEvent world with active event running without BossBar
Got rid of universal WorldEventDisplay and introduced interfaces for each possible display method to get rid of unnecessary iterations and instanceof calls and for a more structured approach implemented new interfaces updated WorldEventLoader and Builder to provide new interfaces ActiveWorldEvent now works with each interface instance
Added some more docs Unregistered ActiveEventIndex Optimized stream usages Optimized interface implementation methods Nullable annotation for Scheduler added
Removed useless debugging Optimized imports Players now receive a message when they join a world with an ActiveWorldEvent
Removed recalcPassives Method since it's redundant
src/main/java/com/projectkorra/rpg/modules/randomavatar/AvatarCycleModule.java
Show resolved
Hide resolved
src/main/java/com/projectkorra/rpg/modules/randomavatar/avatar/AvatarEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/com/projectkorra/rpg/modules/elementassignments/listeners/AssignmentListener.java
Outdated
Show resolved
Hide resolved
src/main/java/com/projectkorra/rpg/modules/randomavatar/avatar/AvatarManager.java
Outdated
Show resolved
Hide resolved
.../java/com/projectkorra/rpg/modules/worldevents/listener/HandleWorldEventDisplayListener.java
Outdated
Show resolved
Hide resolved
Applied changes from CrashCringle's review. Optimized imports Optimized comments Removed redundant ticking calls in Service OG Avatar Cycle re-implemented
… nothing to do with this PR
… improvement that solves the 0 size idiom
GUI Framework & Code Modernization
📖 Summary
This PR introduces a brand-new, lightweight GUI framework (no external GUI libraries) and modernizes large swaths of the codebase to leverage recent Java features and cleaner dependency injection.
🆕 New GUI Framework
InventoryUIAPIhandleClick(…)andonClose(…)BasicInventoryUIFluent Builder
InventoryUIBuilderwithwithItem(x,y,item)for non-clickable slotswithButton(x,y,item,handler)for clickable slotsgetWidth()/getHeight()helpers replace magic numbersLifecycle Service
InventoryServicetracks “which player has which UI open”onClosecallbacks, andcloseAll()on shutdownEvent Routing
InventoryEventListenerlistens for Bukkit click/close events📋 How to Define & Use a Menu
Implement the
Menuinterface by providing a singlebuildUI(Player)method:Open the menu anywhere you have a
Player:Inside a command:
🔄 Code Modernization
I-prefixes on interfacesMap.copyOf(...)for defensive immutabilitySlot)ItemUtilfor DRY item creationstreamsandlambdaexpressions