Skip to main content

Provides data on people, places and more on the EarthMC Minecraft server.

Project description

EarthMC-PY

An unofficial Python package for interacting with both the Official and Dynmap EarthMC APIs.
This package is part of the EarthMC Toolkit and provides extensive info on people, places and more.

Install

$ pip install EarthMC

Initialize Map(s)

from EarthMC import Maps

Aurora = Maps.Aurora()
Nova = Maps.Nova()

Usage Example

from EarthMC import Maps, OfficialAPI
Aurora = Maps.Aurora()

ops = Aurora.Players.all()

def format(res):
    return res.name + ": " + str(round(res.balance))

def onlineBalTop():
    residents = []

    for op in ops:
        res = OfficialAPI.player(op['name'])
        residents.append(res)

    return list(map(format, sorted(residents, key=lambda r: r.balance, reverse=True)))

print(onlineBalTop())

Methods

Players

Base Reference

ap = Aurora.Players
print(ap.all()) # => Outputs all players. (Townless and Residents)

All (List)

online = ap.online.all() # => Outputs list of online players.
townless = ap.townless.all() # => Outputs list of townless players. (Online without a town)
residents = ap.residents.all() # => Outputs list of residents. 

Get (Object)

op = ap.online.get('PlayerName')
tp = ap.townless.get('PlayerName')
res = ap.residents.get('ResidentName') 

Official API

Similarly to the EarthMC NPM library, it is possible to send calls to EarthMC's Official API.
This includes Towny data like balances, timestamps, perms, ranks and more.

from EarthMC import OfficialAPI

town = OfficialAPI.town('venice')
nation = OfficialAPI.nation('venice')
player = OfficialAPI.player('fix') 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EarthMC-3.5.0.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

EarthMC-3.5.0-py3-none-any.whl (11.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page