Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
/ EarthMC-PY Public archive

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

Notifications You must be signed in to change notification settings

EarthMC-Toolkit/EarthMC-PY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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') 

About

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

Topics

Resources

Stars

Watchers

Forks

Languages