API Reference#
EMC#
EarthMC is a large Minecraft server this package lets you get info about things on that server.
- class emc.Nation(name: str, *, data: Optional[Tuple[dict, dict]] = None)#
A nation
- Parameters
name (str) – The name of the nation to get
data (tuple[dict,dict]) – Data from
emc.util.get_data()
- Raises
NationNotFoundException – The nation could not be found
- classmethod all(*, data: Optional[Tuple[dict, dict]] = None) Set[emc.Nation] #
Returns a set of all nations
- Parameters
data (tuple[dict,dict]) – Data from
emc.util.get_data()
- Returns
A set of all nations
- Return type
set[emc.Nation]
- area: int#
The area of the nation
- citizens: Set[emc.Resident]#
The citizens of the nation
- colour: str#
The colour that the towns in the nation appear on the map. Standard hex colour code
- leader: emc.Resident#
The leader of the nation
- name: str#
The name of the nation
- class emc.Resident(name: str, *, data: Optional[Tuple[dict, dict]] = None)#
A person
- Parameters
name (str) – The name of the resident to search for
data (tuple[dict,dict]) – Data from
emc.util.get_data()
- classmethod all(*, data: Optional[Tuple[dict, dict]] = None) Set[emc.Resident] #
Returns a set of all players who are in a town
- Parameters
data (tuple[dict,dict]) – Data from
emc.util.get_data()
- Returns
Set of all players who are in a town
- Return type
set[emc.Resident]
- classmethod all_online(*, data: Optional[Tuple[dict, dict]] = None) Set[emc.Resident] #
Returns a set of all online players
- Parameters
data (tuple[dict,dict]) – Data from
emc.util.get_data()
- Returns
Set of all online players
- Return type
set[emc.Resident]
Weather or not the resident can be seen on the map
- name: str#
The name of the resident
- nation: emc.Nation#
The nation that the resident’s town is in, None if the resident is townless or the town nationless
- npc: bool#
Is this resident an NPC?
- online: bool#
Weather or not the resident is online
- position: Tuple[int, int, int]#
The position of the resident, (0, 64, 0) if hidden == True or None if online == False
- class emc.Town(name: str, *, data: Optional[Tuple[dict, dict]] = None)#
A town
- Parameters
name (str) – The name of the town to look for
data (tuple[dict,dict]) – Data from
emc.util.get_data()
- Raises
TownNotFoundException – The town could not be found
- classmethod all(*, data: Optional[Tuple[dict, dict]] = None) Set[emc.Town] #
Returns a set of all towns
- Parameters
data (tuple[dict,dict]) – Data from
emc.util.get_data()
- Returns
A set of all towns
- Return type
set[emc.Town]
- area: int#
The area of the town
- bounds: util.Bounds#
The bounds of the town
- colour: str#
The colour that the town appears on the map. Standard hex colour code
- flags: Dict[str, bool]#
The flags of the town. pvp, mobs, explosions, fire, capital
- name: str#
The name of the town
- position: Tuple[int, int]#
The position of the center of the town
- ruins: bool#
True if this town in ruins, otherwise False
Util#
Utilities to help with other modules
- class emc.util.Bounds(min_x, min_y, max_x, max_y)#
Namedtuple that represents the bounds of a town
- property max_x#
Alias for field number 2
- property max_y#
Alias for field number 3
- property min_x#
Alias for field number 0
- property min_y#
Alias for field number 1
- emc.util.get_data() Tuple[dict, dict] #
Returns the map data. Useful for making multiple requests
- Raises
requests.HTTPError – Could not get data
- Returns
The map data
- Return type
tuple[dict,dict]
- emc.util.map_link(position: Tuple[float, Any, float], zoom: int = 6) str #
Return a link to the map at the specified position
- Parameters
position (tuple[float,Any,float]) – The position to return a map link to, only the first and last items are used
zoom (int) – The zoom level, must be between 0 and 8
- Returns
The link to the map
- Return type
str
Async#
Exceptions#
Exceptions
- exception emc.exceptions.NationNotFoundException#
A nation could not be found
- exception emc.exceptions.TownNotFoundException#
A town could not be found