Skip to content

Rewards Management

AustereTony edited this page Jun 16, 2020 · 11 revisions

Rewards Management

When you start the game for the first time in the "./minecraft/config/oxygen/data/server/daily rewards/" folder, monthly rewards data files will be generated. By default, an emerald is used as a reward for each day.

File structure:

The reward data file is an array of JSON objects. The number of objects depends on the length of the month, for February there are 29 entries. The order of rewards is determined by the index of the object in the array (the "day" field is not taken into account, it was created for convenience).

Reward object properties:

  • "day" (integer) - day of the month for which the reward will be granted

  • "type" (string) - reward type

Currently available: "ITEM", "CURRENCY", "COMMAND" and "SCRIPT".

  • "description" (string) - inscription under reward icon

The inscription is designed to briefly describe the reward (“item” or “currency”) for ease. A specific value ("Item") or a localization key ("oxygen_dailyrewards.description.item") can be used.

  • "amount" (long) - items amount or currency value , not used for "COMMAND" type

  • "special" (boolean) - unique reward flag

The flag can be used to demonstrate the value of the reward (if "true", a star will be displayed in the upper right corner of the reward widget).

  • "itemstack" (json object)(only for "ITEM" type) - json object with item data

The data of any item can be obtained in the game with the chat command "/oxygenc core -item -to-json {file name (single world, without '.json')}". File will be created in the ".minecraft/config/oxygen/data/client/core/itemstack/" folder.

  • "currency_index" (integer)(only for "CURRENCY" type) - currency index

  • "tooltip" (string)(only for "COMMAND" type) - tooltip will be displayed when you hover over the reward icon

  • "icon" (string)(only for "COMMAND" type) - image name (with ".png"), which will be used as a reward icon

The image width should be a multiple of 48 pixels (small widget) or 96 pixels (large widget). The higher the resolution, the better the quality. Images should be located in the ".minecraft/config/oxygen/data/server/daily rewards/icons/" folder. Textures can be located in subfolders, then the name must additionally contain a directory (eg. "june/reward_7.png"). If there is no file, the standard texture "MISSING_TEXTURE" will be used.

  • "commands" (string)(only for "COMMAND" type) - console commands

Commands must begin with a slash "/" and be separated by a semicolon ";". Pointers: "@p" is the player’s nickname, "@pX" is the player’s coordinate in X, "@pY" is the player’s coordinate in Y, "@pZ" is the player’s coordinate in Z, "@dim" - dimension id.

Note: some commands require command blocks to be enabled

  • "script" (string)(only for "SCRIPT" type) - executable script name

The script should be located in the ".minecraft/config/oxygen/data/server/daily rewards/" folder. Scripts can be located in subfolders, then the name must additionally contain a directory (eg. "misc/misc_1.ts"). The script should return boolean "true" on successful execution to successfully complete reward transaction.

Note: Script support is provided by the Scripting Adapter (WIP) add-ons, however Core has a built-in adapter for ECMAScript (TypeScript, JavaScript) and to activate it you need to set the value "enable_ecmascript_adapter: true" in the config "core.json".

Clone this wiki locally