An extension for Dimensions, adding an API to easily switch players to different servers using external services.
- Download the Dimensions from popstarfreas/Dimensions/releases
- Download this extension from Zazzik1/SwitchServersByAPI/releases
- Put the unpacked extension in
<Dimensions root>/build/extensions/directory
The directory structure should look like this:
<Dimensions root>/
|-- build/
| |-- node_modules/
| |-- extensions/
| |-- SwitchServersByAPI_1.0.x/
| |-- index.js
| |-- config.json
...
Edit the config.json file to update the following settings:
port- The port on which the API server listens for incoming requests.verbosity- Accepts values 0, 1, or 2. Controls the level of logging detail the extension provides.disabledEndpoints- If a given endpoint is set totrue, it will be disabled and not available through the API.
Switches the client to a server with name described by a serverName parameter.
Note: Currenlty, the API server does not validate the Content-Type header. It expects all incoming data to be in JSON, so sending data in formats like form-data or x-www-form-urlencoded will not work as expected.
Parameters:
clientUUID- requiredserverName- required
Example request:
curl -X POST -d '{"serverName": "server_B", "clientUUID": "6c3577e1-0727-4b8c-92b4-ea28953dda39"}' "http://127.0.0.1:3000"Returns information about clients and servers.
Note: The information about servers is updated whenever a client connects or disconnects and becomes available in the API only after at least one client has connected.
Example request:
curl "http://127.0.0.1:3000"Example response:
{
"servers": [
"server_A",
"server_B"
],
"clients": [
{
"uuid": "6c3577e1-0727-4b8c-92b4-ea28953dda39",
"name": "Zazzik1",
"serverName": "server_A"
}
]
}