mojang.minecraft.slp

class mojang.minecraft.slp.PingVersion(value)

Bases: IntFlag

Parameters:
  • V1_7 (int) – Use the ping protocol for version 1.7 and higher

  • V1_6 (int) – Use the ping protocol for version 1.6

  • V1_4 (int) – Use the ping protocol for version 1.4 and 1.5

  • V1_3 (int) – Use the ping protocol for version 1.3 and lower

  • V_ALL (int) – Use all the ping protocol

V1_3 = 8
V1_4 = 4
V1_6 = 2
V1_7 = 1
V_ALL = 15
mojang.minecraft.slp.ping(addr: tuple[str, int], timeout: int = 3, flags: int = PingVersion.V_ALL) SLPResponse | None

Ping the server for information

Parameters:
  • addr (tuple) – The address and the port to connect to

  • timeout (int) – Time to wait before closing pending connection (default to 3)

  • flags (int) – Which version of the ping version to use

Example:

>>> from mojang.minecraft import slp
>>> slp.ping(("localhost", 25565))
SLPResponse(
    protocol_version=754,
    version='1.16.5',
    motd='A Minecraft Server',
    players=Players(total=(0, 20), list=[]),
    ping=1
)