Types
ConnectionError = object of HttpRequestError
- Raised when an attempt to connect with the API has failed. This mainly happens when the user passes an incorrect IP address.
DataError = object of KeyError
- An internal exception primarily related to the library itself. Raised when the given key for accessing a particular data is not found.
Mod = object name*, version*: string
- Represents a mod of a Minecraft server.
NotInitializedError = object of KeyError
- Raised when the data required is missing from an instance of the Server object. This typically happens when Server.refreshData() has not been executed anywhere before interacting with the package.
Platform {.pure.} = enum JAVA, BEDROCK
- Represents the platform / edition of a Minecraft server.
Player = object name*, uuid*: string
- Represents a player of a Minecraft server.
PlayerCount = object online*, max*: int
- Represents the total amount of online players (and the maximum player capacity) of a Minecraft server.
PlayerNotFoundError = object of DataError
- Raised when a player could not be found within the list of online players.
Plugin = object name*, version*: string
- Represents a plugin of a Minecraft server.
Protocol = object name*: string version*: int
- Represents the protocol of a Minecraft server.
QueryError = object of DataError
- Raised when a particular part of the data could not be queried properly depending on the server platforms and other factors.
Server = ref object address*: string platform*: Platform
- Represents an object reference of a Minecraft server. You will primarily use this object to interact with the API.
ServerDebugValues = object ping*, query*, srv*, querymismatch*, ipinsrv*, cnameinsrv*, animatedmotd*, cachehit*: bool cachetime*, cacheexpire*: string apiversion*: int
- Represents the debug values related to a Minecraft server.
ServerInfo = object raw*, clean*, html*: seq[string]
- Represents certain information related to a Minecraft server. Only included if the server uses player samples for gathering information.
ServerMap = object raw*, clean*, html*: string
- Represents the map name of a Minecraft server.
ServerMOTD = object raw*, clean*, html*: seq[string]
- Represents the MOTD (Message of The Day) of a Minecraft server.
Procs
proc debug(self: Server): ServerDebugValues {. ...raises: [NotInitializedError, DataError, KeyError], tags: [], forbids: [].}
- Returns the debug values related to the Minecraft server.
proc getPlayerByName(self: Server; name: string): seq[Player] {. ...raises: [QueryError], tags: [], forbids: [].}
- (Query-dependant) Returns a sequence of players currently online on the server matching the name given.
proc getPlayerByUUID(self: Server; uuid: string): Player {. ...raises: [PlayerNotFoundError, QueryError], tags: [], forbids: [].}
- (Query-dependant) Returns the data associated with a player through a Player object.
proc info(self: Server): Option[ServerInfo] {. ...raises: [NotInitializedError, KeyError], tags: [], forbids: [].}
- (If detected) Returns a ServerInfo object representing some extra bits of information related to the server.
proc isEulaBlocked(self: Server): Option[bool] {....raises: [NotInitializedError], tags: [], forbids: [].}
- (Java-only) Returns a boolean value depending on if the Minecraft server has blocked EULA or not.
proc motd(self: Server): Option[ServerMOTD] {. ...raises: [NotInitializedError, KeyError], tags: [], forbids: [].}
- (If detected) Returns a ServerMOTD object representing the MOTD (Message of the Day) for the server.
proc playerCount(self: Server): Option[PlayerCount] {. ...raises: [NotInitializedError, KeyError], tags: [], forbids: [].}
- (If detected) Returns a PlayerCount object representing the total amount of active players (and the maximum player capacity) of the server.
proc refreshData(self: Server): Future[void] {....stackTrace: false, raises: [Exception], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect], forbids: [].}
- Connect to the API and load the data related to the given Minecraft server into the Server object.