pyplanet.contrib.player

The player contrib will provide player list and information to the apps and core.

class pyplanet.contrib.player.PlayerManager(instance)[source]

Player Manager.

You can access this class in your app with:

self.instance.player_manager

With the manager you can get several useful information about the players on the server. See all the properties and methods below for more information.

Warning

Don’t initiate this class yourself.

count_all

Get all player counts (players + spectators).

count_players

Get number of playing players.

count_spectators

Get number of spectating players.

get_player(login=None, pk=None, lock=True)[source]

Get player by login or primary key.

Parameters:
  • login – Login.
  • pk – Primary Key identifier.
  • lock – Lock for a sec when receiving.
Returns:

Player or exception if not found

Return type:

pyplanet.apps.core.maniaplanet.models.Player

handle_connect(login)[source]

Handle a connection of a player, this call is being called inside of the Glue of the callbacks.

Parameters:login – Login, received from dedicated.
Returns:Database Player instance.
Return type:pyplanet.apps.core.maniaplanet.models.Player
handle_disconnect(login)[source]

Handle a disconnection of a player, this call is being called inside of the Glue of the callbacks.

Parameters:login – Login, received from dedicated.
Returns:Database Player instance.
Return type:pyplanet.apps.core.maniaplanet.models.Player
max_players

Get maximum number of players.

max_spectators

Get maximum number of spectators.

on_start()[source]

Handle startup, just before the apps will start. We will throw connects for the players so we know that the current playing players are also initiated correctly!

online

Online player list.

Exceptions for Map Manager.

exception pyplanet.contrib.player.exceptions.PlayerNotFound[source]

Player not found