[1.8.96] Plugin id aliases

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
Previous topicNext topic
User avatar
Lobby
Inhabitant of a Supercluster
Reactions:
Posts: 3759
Joined: 26 Oct 2008, 10:34
Plugins: Showcase Store

[1.8.96] Plugin id aliases

Post by Lobby »

A new feature introduced with version 1.8.96 are plugin ids aliases. They can be useful if you want to change the ids of objects that can be used by others (e.g. light definitions). Since changing the ids would break plugins that depend on the former ids you can now specify aliases for the id under which the plugin can be found, too.

Let's assume you have the following json code:

Code: Select all

[
  {
    "id":"myoldid",
    ...
  }
]
You can now define an alias just like that:

Code: Select all

[
  {
    "id":"myoldid",
    "alias":"newid",
    ...
  }
]
You can also define multiple aliases:

Code: Select all

[
  {
    "id":"myoldid",
    "aliases":["newid", "anothernewid"],
    ...
  }
]
It doesn't matter if you write alias or aliases as attribute name, both can take a single string or an array of strings. Plugin references to other plugins by id should behave equivalent no matter if it uses the original id or an alias id of it.
Previous topicNext topic