Skip to content

Scripts

FX7 edited this page Mar 8, 2021 · 3 revisions

scripts.yml explanation

In the scripts.yml file all scripts are defined.

Every script contains a unique name and the actions, that are called within this script. The example script is called rewardChest and determines the lasz location of a player, sets the material under this location and then adds items to this block. To do this, the player and the material for setMaterial (an valid container block) must be given as parameter.

An example curl call would be:

curl -v -H "App-Name: testApp" -H "App-Key: 1234-abcd" -X POST "http://localhost:8080/rest/v1/script/rewardChest/execute" --data "{'player':'steve','material':'CHEST','itemStack':{'material':'DIAMOND','amount':'64'}}"

This call would get the last location of player steve, sets the material at the location of this player to "CHEST" and then adds 64 Diamonds.

`scripts:

  • ==: ScriptEntity name: rewardChest actions:
    • ==: RestActionStub context: PLAYER action: getLastLocation
    • ==: RestActionStub context: WORLD action: setMaterial
    • ==: RestActionStub context: WORLD action: addToContainer`

Clone this wiki locally