Plugin configurations

Posted by Miss 2 years ago

Developer

Plugin configurations

Openplanet has a new feature for plugin configurations. This allows you to set blobs of Json for your specific plugin directly on the website, which your plugin can then fetch and use. Very useful if you have to edit a configuration that frequently changes, without having to upload a new version of your plugin.

For example, you could have the following configuration defined on your plugin admin panel:

{
  "players": [ "Miss-tm" ]
}

We can then make a request from your plugin scripts to fetch this Json:

void Main()
{
  auto req = Net::HttpGet("https://openplanet.dev/plugin/myplugin/config/foobar");
  while (!req.Finished()) {
    yield();
  }
  auto js = Json::Parse(req.String());
  string firstPlayer = js["players"][0];
  print("First player: " + firstPlayer);
}

This post was written by Miss(Trusted developer)