Databases & Plugin Calls

2min read
Sheet 26 of 47 · Server

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

EndpointParametersAnswer
sqlurl (JDBC), user, password, query, max (rows, default 50), create: true to let SQLite make a missing filecount and rows for a select, updated for anything else
mongouri (default mongodb://127.0.0.1:27017), db, collection, filter, sort, max (default 20); insert, update (with filter), delete: truecount and rows, or inserted, matched and modified, deleted
redishost, 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
ParameterWhat it does
pluginThe plugin to start from
pathThe same path inspect takes
methodThe method to call on what the path leads to
argsArguments as text, split by commas. args=["a, b", 5] as JSON for values with commas
typeStarts at the static side of a class instead of the plugin. Works on inspect too
on=asyncRuns 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.

Loading the index

Enter openUp Down moveEsc close