berconpy.ArmaCache

class berconpy.ArmaCache

Bases: object

A basic cache implementation for ArmaClient.

When a client is set, this will add an on_login listener which queries the admin_id and fetches the current player list to quickly update itself.

Methods

add_connected_player(payload)

Adds a player to the cache after having connected.

add_missing_player(payload)

Adds a player that was missing from the cache.

get_player(player_id)

Looks up a player from cache using their server-given ID.

on_login()

remove_player(player_id)

Invalidates a player in the cache.

set_player_guid(payload)

Sets the GUID of a cached player.

update_players(response)

Updates the cache by parsing a response to the "players" command.

verify_player_guid(payload)

Verifies the GUID of a cached player.

Attributes

admin_id

The RCON admin ID this client was given or None if the client has not logged in.

client

The client this cache is assigned to.

players

A list of players in the server.

add_connected_player(payload)

Adds a player to the cache after having connected.

Return type:

Player

Returns:

The player that was created.

add_missing_player(payload)

Adds a player that was missing from the cache.

Return type:

Player

Returns:

The player that was created.

get_player(player_id)

Looks up a player from cache using their server-given ID.

Parameters:

player_id (int) – The ID of the player.

Return type:

Player | None

Returns:

The retrieved player or None if not found.

remove_player(player_id)

Invalidates a player in the cache.

Return type:

Player | None

Returns:

The player that was removed, if any.

set_player_guid(payload)

Sets the GUID of a cached player.

Return type:

Player | None

Returns:

The player that was updated, if any.

update_players(response)

Updates the cache by parsing a response to the “players” command.

Return type:

None

verify_player_guid(payload)

Verifies the GUID of a cached player.

Return type:

Player | None

Returns:

The player that was updated, if any.

property admin_id: int | None

The RCON admin ID this client was given or None if the client has not logged in.

property client: ArmaClient | None

The client this cache is assigned to.

property players: list[Player]

A list of players in the server.