dolor.clients.client

class Client(version, address, port=25565, *, lang_file=None, access_token=None, client_token=None, username=None, password=None, name=None)[source]

Bases: dolor.connection.Connection, dolor.packet_handler.PacketHandler

session_server = 'https://sessionserver.mojang.com/session/minecraft'
register_packet_listener(*args, outgoing=False)[source]

Registers a packet listener.

Parameters
  • func (coroutine function) – The packet listener.

  • *checkers (subclass of Packet or int or function) –

    If a subclass of Packet, then the listener will be called if the packet is an instance of that class.

    If an int, then the listener will be called if the id of the packet is equal to the passed int.

    If a function, then the function can either return a bool and take one argument, which represents the packet to check, or it can return a bool and take two arguments, the first being the relevant Connection, and the second being the packet to check.

  • **kwargs – Keyword arguments that must match the keyword arguments passed to listeners_for_packet() for the packet listener to be included in its return.

Raises
  • TypeError – If func isn’t a coroutine function.

  • ValueError – If no checkers are specified.

create_task(coro)[source]

Internal function used to ensure that all listeners complete.

async listen_to_packet(p, *, outgoing)[source]
async write_packet(*args, **kwargs)[source]

Writes a packet.

Parameters
  • packet (subclass of Packet or Packet) –

    If a subclass of Packet, then the packet to write will be created by forwarding packet and **kwargs to the create_packet() method. Otherwise, packet is the packet to write.

    packet being a subclass of Packet is preferred so that the packet is created with the correct context for the connection.

  • **kwargs – The packet attributes to set and their corresponding values. Only able to be passed if packet is a subclass of Packet.

Returns

The written packet.

Return type

Packet

Raises

TypeError – If **kwargs is passed but packet isn’t a subclass of Packet.

async listen()[source]
async on_start()[source]
async startup()[source]
async start()[source]
run()[source]
async auth(**kwargs)[source]
async send_server_hash(server_hash)[source]
async status()[source]
async login()[source]