Player

Flags

When adding flags to a player entity, you should prefix the flag name with the unique prefix of your module. For example, flags related to QLD Minecraft are prefixed with qm_

It is not recommended to change flag values that where not created by your own module

Below is a table of flags that QLD Minecraft uses for players that can be used by modules:

Flag name

Default value

Details

qm_developer

false

If the player is a developer

qm_i18n

en

Country code of the player language localization

qm_region

<empty>

The top most region the player resides in by priority

qm_region_list

<map[]>

A map of regions the player currently resides in by cuboid. The key is the region ID while the value is the priority

qm_region_biomes_<region_id>

<list[]>

A list of biomes associated with a region within the player flag qm_region_list. Only regions within the player flag

qm_region_list are expected to be present

qm_last_death_location

<empty>

Last location player died

Determine if player is in developer mode:

<player.in_group[developer]>

Override player place block in a region that typically denies:

on player places block priority:-1:
- flag player qm_override.block_place:true

Player data

Modules are allowed to store data inside the players YAML data file provided that they contain their data under a single key that is named appropriately. This YAML file is available while the player is online and can be loaded/unloaded when the player is offline by the use of tasks. The YAML identifier is qm_<player_uuid>

# Reading the player data key 'trait_vendor' of the current player
- define value:<yaml[qm_<player.uuid>].read[trait_vendor]>

Keys beginning with qm or qldminecraft are reserved by QLD Minecraft itself and should not be used by modules

Loading player data

When you require to load a player data file when a player is offline, you can use the qldminecraft.player.yaml.load task with a player item as the definition. The data file will remain in RAM until you either use the qldminecraft.player.yaml.unload task or the player logs in and logs out.

If the player logs in after you load a player data file, or the data file is already loaded, the data file will not be reloaded.

Player data files loaded while the player is offline will not be periodically saved by the server as per online players.

# Loading the player data file for nomadjimbob
- run qldminecraft.player.yaml.load def:<server.match_player[nomadjimbob]>

Saving player data

You can use the task qldminecraft.player.yaml.save with a player item as its definition to save a player data file. Modules are only required to perform this they load a player data file manually and the player is offline, else player data will be saved peridically by the server, or when the player logs out.

# Saving a player data file
- run qldminecraft.player.yaml.save def:<server.match_player[nomadjimbob]>

Unloading player data

When a module is finished with a player data file, it can be unloaded using the qldminecraft.player.yaml.unload task with a player item as its definition. The unload data task does not save the file before unloading it from memory.

Modules should not unload player data if the player is online as this can cause issues for the players current session.

# Unloading a player data file
- run qldminecraft.player.yaml.unload def:<server.match_player[nomadjimbob]>