How to split plugins into core and child ones to reuse the code?

Discussion in 'Plugin Development' started by LeonardhoFstader1, Jul 12, 2020.

Thread Status:
Not open for further replies.
  1. Hi everyone!
    So I was thinking about playing around with a group of plugins which all depend on one to avoid having to code the same stuff over and over again. So far, so good, I managed to get all the simple tasks working ("depend" in plugin.yml, adding core plugin to build path, calling methods, ...).omegle
    As always though, the devil lies in the details... I then tried to implement a Game class to the core, as I wanted to use this for minigames. The "core class" will have the basics in it, each plugin can have its own Game class that just extends it to add something. I also wanted to do the same thing for the configuration files however that seemed kinda not doable at least if each plugin's config is a little different. So I coded the config into the "child" plugins but then I ran into the actual problem: Calling the core Game class (for example to make changes to running games) and then also wanting to store the changes to the config. I can't call the config from the core class as each plugin will have its own config, but I also didn't manage to integrate a "config manager" to the core.
    Do you guys have any ideas on how I can make this concept work? Is there a better way to set this up or is it just a silly idea and will safe me no time at all? I quite like the idea of it though.
     
    Last edited: Jul 15, 2020
  2. Online

    timtower Administrator Administrator Moderator

    @LeonardhoFstader1 Have the config handler work based on which plugin it is instanced in?
     
Thread Status:
Not open for further replies.

Share This Page