1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Plugin to load other plugins

Discussion in 'Requests' started by Zorlac, Aug 30, 2019.

  1. Zorlac

    Zorlac Spider

    Messages:
    11
    A plugin that will load other plugins that are listed in a configuration file. However, these "other plugins" are in a different folder that is located outside of the main Pocketmine server folder structure. Because of this, the plugin dataFolder must be altered to match the default location for the server (/plugins/PluginName/) or the other loaded plugins will not work properly and the server owner will not be able to alter the config files for the loaded "other plugins".

    I've already written this for Spigot and it works perfectly. However, changing the data folder was a challenge for me. I had to hire an expert for the solution, which was to use reflection to change the data folder attribute. (Oh sure, it looks simple now!)

    I'm not quite sure how to do the same thing in PHP. While I'm quite familiar with PHP (old school), I'm quite unfamiliar with OOP, especially as it relates to Pocketmine. Suggestions are much appreciated.

    Happy to compensate someone for their consulting time to bring me up to speed on Pocketmine OOP. I've been checking out other plugins for ideas, but almost all of them are created for doing something after the server is loaded and running. I have not been able to locate examples of interfacing directly with PluginManager like I've done in Spigot:

    Code:
                    Plugin plugin = pluginManager.loadPlugin(pluginJar);
                    setDataFolder(plugin,newDataFolder); // This calls a function that uses reflection to change the dataFolder attribute.
                    plugin.onLoad();
                    pluginManager.enablePlugin(plugin);
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Saving data folders in the source folder containing the plugin is a legacy thing. Delete legacy data directories in pocketmine.yml so that plugin data are stored in a specific plugin_data directory.
     
  3. Zorlac

    Zorlac Spider

    Messages:
    11
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.