-
Notifications
You must be signed in to change notification settings - Fork 1
Command object formatting, modifiers, root command abstraction #13
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
whimxiqal
left a comment
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 have some thoughts about organizing the Portal and Destination classes without so many static components. See below.
| */ | ||
| public class Portal { | ||
|
|
||
| private static List<Portal> portals = new ArrayList<>(); |
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.
@jackah2 The Portal file gets a little too busy with these static fields and methods. While the behavior of these cached portals and destinations are basically static, I am of the mind that storage should be handled by storage classes, separate from any base object class to reduce confusion and clutter. I like what you did with the LocationSaver; maybe another portal/destination handler could be added as a field in Main and then all command classes and any future APIs can use Main's instance of the handler instead of using a bunch of static fields bundled into the Portal class.
It also doesn't really matter because I don't think there are plans to expand on this plugin so reducing clutter might not be important anyway. This is also my organizational opinion and maybe static fields are clearer.
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 definitely agree that there is a need for abstraction here. In some of the other plugins, I use a manager with static fields to take care of creating, removing, and fetching portals.
| private static MyConfig portalData; | ||
| private LocationSaver locationSaver; | ||
|
|
||
| public static Main getInstance() { |
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'm not the biggest fan of statically accessing the main class. I know this is a bit contradictory given my comment about making Portal/Destination managers, but that's just the personal style I use.
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.
The reason why I like it is for those managing classes can be accessed with that single static method, so there are practically no other public static fields and everything is retrieved from the same place, and for logging because I don't want to be five references removed from the Main class and have to pass the plugin through everything just to access the logger (or managers within Main). I guess it just depends on how many static fields you want, I'm generally for few as possible.
I have yet to delve into other files, really. I just did the command files to see how you like these types of changes.