[Kotlin] Design help needed, Class instance event subscriptions while splitting logic from data
This posts language and code is in Kotlin. Kotlin is based on java and pretty similar but there are some small differences. I am mainly seeking for a good way to execute this.
You can find the full Code I'm talking about here: https://github.com/HacktheTime/SkyHanni/tree/tutorials/src/main/java/de/hype/bingonet/shared/tutorials
Due to a set of factors I was told by someone else that I should split the logic from the data. So far so good.
But for me the Issue is how do I execute that?
Definitions:
Nodes: Either Fork or Step
Step: A direct Task for the User to do. Such as collect a certain amount of a resource etc.
Fork: This contains a list of other steps and is responsible for things like when you can do some stuff in your own order, can pick different paths based on your own choosing, you have to wait for external things to happen etc.
I am working for an In game guide that takes a list of nodes and will use them 1 by 1 and wait for you to complete them auto completing and telling you what the next step is. A complicating Factor is that I have Forks.
Example of someone elses implemenation that does not have all the Functionality I want to add: https://www.youtube.com/watch?v=rIo6RNXrjw8
(content continues next message)
GitHub
SkyHanni/src/main/java/de/hype/bingonet/shared/tutorials at tutoria...
BingoNet is a modern Minecraft Mod for Hypixel SkyBlock's Bingo Event. - HacktheTime/SkyHanni
Frog
YouTube
Bingo Guide June 2025 (Hypixel Skyblock)
Bingo Guide
BingoHelper: https://discord.gg/CJ7AXGqqrD
Splash Servers
BingoSplashCommunity: https://discord.gg/bingo
BingoBrewers: https://discord.gg/47uqrUh9WV
Useful Modules:
/ct import bingoplus
6 Replies
⌛ This post has been reserved for your question.
Hey @Hype_the_Time (PING ON REPLY)! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
I want the Code to be relatively efficient. This means no constant processing of all nodes. SkyHanni has a Event System (see SkyhanniEvent). While they cant always be used directly they can be used as a trigger for checks too. So you don't run checks every tick etc. Optimally I would like only active nodes to be processed. Some of my nodes will be quite resource intense so we shouldn't run them more often than needed. In case of the CakeTutorialStep we can watch the Event and only then run the check.
Right now my Logic is in the same class as my data. This causes Issues since I want those nodes to be serialisable and deserializable by copying their code to other environments as well which don't have the needed code.
The way you subscribe to events is with @HandleEvent on the method as well as the event being a parameter. I personally would believe that these are required to be objects and not classes causing issues otherwise but I am not sure about that.
I personally am big a Fan of over engineering things as other would say. If there is a way to implement something with better maintainability, splitting and more convenient coding (such as interfaces and abstractions) I prefer the approach.
Example Files:
CakeTutorialStep: Example Step
ObtainBingoGoalTutorialStep: A example step with both active and event based check.
WhileTutorialNode: A While loop for when you need to do a certain step until you complete something else.
Again. These files should not cinatin the logic but still do currently.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.Bump
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.