Entire project need refactoring
wysohn opened this issue ยท 8 comments
#167 Require re-organization of the JavaPluginBridge and TriggerReactor class in order to put the ConfigManager in the core layer.
First, start with JavaPluginBridge and TriggerReactor and we will eventually refactor the entire structure of the project.
We will be able to put duplicated codes in a single abstract class by doing so.
First Proposal
We will be able to merge the majority of the codes in the AbstractJavaPluginAdapter and AbstractBukkitTriggerReactor since both of the current JavaPluginBridges have lots of duplicated codes. If we need distinction, later on, we can put them in the concrete class (LatestJavaPluginAdapter and LegacyJavaPluginAdapter) separately and make an abstract method to use them.
Any suggestion?
@gerzytet @rkdrns4747
@wysohn
What's stopping us from making this whole thing simpler by combining TriggerReactor and JavaPluginBridge into one class?
@gerzytet
That's how Bukkit API is made :(
because the JavaPlugin is a Abstract class itself, we cannot extend from two different classes: JavaPlugin and TriggerReactor(in core) at the same time.
They both are Abstract class, so JavaPluginBridge extends the TriggerReactor, and TriggerReactor extends JavaPlugin.
I think I once tried to use the Plugin interface, yet Bukkit API only accepts the JavaPlugin when it loads.
The only reason why JavaPluginBridge implements Plugin interface is to naturally support various Bukkit related methods. Some methods require Plugin as parameters, which I don't remember.
@wysohn
JavaPlugin extends plugin. Why do we need to specifically extend Plugin?
@gerzytet
Some methods require Plugin as parameter.
For example, we can access TriggerReactor directly using 'plugin' variable from any Executor or Placeholder, yet if we were to use some of the Bukkit methods (task scheduler perhaps), it has to provide Plugin instance, yet TriggerReactor is not Javaplugin but Javapluginbridge is. So just making TriggerReactor to implement Plugin allows more intuitive access to Bukkit methods without deep java knowledge. All TriggerReactor has to do is delegate the functionality of javapluginbridge.
@gerzytet
Are you working on anything?
I will move it to the test phase if you are done with it.