Databases & Plugin Calls
What a plugin saved, read from where it saved it. sql, mongo and redis are agent-style endpoints, so they work as call server/<name>, in a server step, and in assertServer with a timeout that polls until the row is there.
- {do: assertServer, path: sql, url: "jdbc:sqlite:plugins/Shop/data.db", query: "select coins from players where name = 'Steve'", field: "rows[0].coins", value: 150, timeout: 3000}
- {do: assertServer, path: mongo, uri: "mongodb://127.0.0.1:27017", db: sky, collection: islands, filter: '{"owner": "Steve"}', field: "rows[0].level", value: 3}
- {do: assertServer, path: redis, command: "HGET player:Steve coins", field: value, value: "150"}Endpoints
| Endpoint | Parameters | Answer |
|---|---|---|
sql | url (JDBC), user, password, query, max (rows, default 50), create: true to let SQLite make a missing file | count and rows for a select, updated for anything else |
mongo | uri (default mongodb://127.0.0.1:27017), db, collection, filter, sort, max (default 20); insert, update (with filter), delete: true | count and rows, or inserted, matched and modified, deleted |
redis | host, port, user, password, db, command (quotes keep a value with spaces together) | value: text, a number, a list or null |
sql runs inside the server through IgniteTestAgent, with the SQLite and MySQL drivers Paper carries and any driver a plugin brought along. A relative SQLite path is therefore relative to the server folder. A 16 byte column reads as the UUID it holds.
mongo and redis are answered by the tool itself and need no agent.
Calling plugin code with invoke
invoke calls a method of the plugin, for what no command reaches: forcing a save, ending a round, moving a timer.
java -jar IgniteTestTool.jar call server/invoke plugin=IgniteZombies path=arenaService method=saveAll
java -jar IgniteTestTool.jar call server/invoke plugin=Shop path=economy method=deposit args=Steve,150
java -jar IgniteTestTool.jar call server/invoke plugin=Shop type=com.acme.shop.Prices method=reload| Parameter | What it does |
|---|---|
plugin | The plugin to start from |
path | The same path inspect takes |
method | The method to call on what the path leads to |
args | Arguments as text, split by commas. args=["a, b", 5] as JSON for values with commas |
type | Starts at the static side of a class instead of the plugin. Works on inspect too |
on=async | Runs the call off the server thread. Without it the call runs on the server thread |
Arguments become what the method takes: numbers, booleans, enum names, a UUID or the name of an online player, a world name, world:x:y:z for a location, a material for an item. Among overloads the first one all arguments fit is called, and a miss lists the signatures there are.