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
Packetorintorfunction) –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 passedint.If a
function, then the function can either return abooland take one argument, which represents the packet to check, or it can return abooland take two arguments, the first being the relevantConnection, 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
funcisn’t a coroutine function.ValueError – If no checkers are specified.
- async write_packet(*args, **kwargs)[source]¶
Writes a packet.
- Parameters
packet (subclass of
PacketorPacket) –If a subclass of
Packet, then the packet to write will be created by forwardingpacketand**kwargsto thecreate_packet()method. Otherwise,packetis the packet to write.packetbeing a subclass ofPacketis 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
packetis a subclass ofPacket.
- Returns
The written packet.
- Return type
- Raises
TypeError – If
**kwargsis passed butpacketisn’t a subclass ofPacket.