Returning Value from Dispatch Command

Discussion in 'Plugin Development' started by Smeary_Subset, Oct 16, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    Smeary_Subset

    I want to have a SQL Connector plugin that manages all the data transformation between my server and database. If another plugin needed to receive data from the database, I would like to have it dispatch a custom command provided by the SQL Connector plugin that fetches the data for it and returns it through the #dispatchCommand method. Given that #dispatchCommand cannot return a custom value, how can I work around this?

    Thanks for the help.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Smeary_Subset You can't.
    What you can do is have a callback for it.
     
  3. Offline

    Smeary_Subset

    Rip, that's what I figured.
     
  4. Offline

    Strahan

    But... why? If you already have a plugin you made for SQL management, why not just create an API for it that can be exposed to other plugins? Then they can just use that to request information from SQL.
     
  5. Offline

    Smeary_Subset

    Because I've never created an API or library (but I really want to learn)

    Have any good resources on how I could start?
     
  6. Offline

    timtower Administrator Administrator Moderator

    Comes down to having public functions that other plugins can call.
    That is it, then they need to connect to your plugin.
     
    Kars likes this.
  7. Offline

    Smeary_Subset

    If I wanted to import my custom library/API into another plugin through Maven, can I use a GitHub repository to pull it from?
     
  8. Offline

    timtower Administrator Administrator Moderator

    No idea on that, I don't use maven myself.
     
Thread Status:
Not open for further replies.

Share This Page