Skip to main content

MushMC-API Overview

  • MushMC-API is a Python library for developers that facilitates access to the MushMC server API, making project creation more efficient and dynamic. It is unofficial, but offers an improved and independent experience for interested developers.

Table of Contents

Installation

To install the library, use the command below:

python -m pip install mushmc-api

Getting started

Importing the library into your Python project:

from mushmc import MushMC
  • To use the library, you must install it via pip. Click here to see how to install it.

Creating an instance of the MushMC class:

mushmc = MushMC() # async_run=False
  • The class has an optional parameter, which is async_run, which only accepts Boolean values. If True, the instance will be asynchronous, otherwise it will be synchronous. The default is False.

Using the created instance to obtain information about the "FHDP" player:

player = mushmc.Player(nick_or_uuid='FHDP') # retries=0, timeout=5
  • The class has a mandatory parameter, which is nick_or_uuid, which only accepts values of type str. The value can be the player's nick or uuid.
  • Furthermore, it has two optional parameters, which are retries and timeout, which only accept values of type int. The retries is the number of attempts that the program will make to obtain the player's information, if an error occurs. The timeout is the maximum waiting time to obtain player information. retries defaults to 0 and timeout defaults to 5.

Getting general player information:

raw_response = player.raw_response

first_login = player.first_login
last_login = player.last_login
is_online = player.is_online
discord = player.discord
account = player.account
rank = player.rank
clan = player.clan
  • The class has an attribute called raw_response, which returns a dictionary with all available player information, without any processing.
  • In addition, it has other attributes, which are:
    • first_login: returns in unix format the date and time of the first time the player entered the server.
    • last_login: returns in unix format the date and time of the last time the player logged into the server.
    • is_online: returns a boolean value indicating whether the player is online or not.
    • discord: returns a dictionary with the player's Discord account information, if they have linked it.
    • account: returns a dictionary with the player's account information on the server.
    • rank: returns a dictionary with the player's rank information on the server.
    • clan: returns a dictionary with the player's clan information on the server.

Getting player information about game modes (example: "bedwars"):

play_time = player.play_time
game_list = player.list_games()
game_stats = player.get_game_stats(game='bedwars')
  • The class has other attributes and methods, which are:
    • play_time: returns a dictionary with information about the player's playing time in each game mode.
    • list_games(): returns a list with the names of game modes in which the player has played.
    • get_game_stats(game): returns a dictionary with player information about the specified game mode. The game parameter is mandatory and only accepts values of type str. The value must be the name of the game mode and is case-sensitive.

Disclaimer

  • This library is unofficial and is not affiliated with the MushMC server. It is an independent project, developed by a fan of the server. The library is open source and can be found on my GitHub repository.

Metadata

Release files for mushmc-api 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mushmc-api 0.0.2
File Size Uploaded
mushmc-api-0.0.2.tar.gz 4.6 kB Details

Release files / mushmc-api-0.0.2.tar.gz

Download URL mushmc-api-0.0.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e451a9793278c0f6cfe953fddbc7282ecf1bb2c217be0ce60268d22d9c065b37
BLAKE2b-256 checksum
How to use checksums
ba6b99b34391f0e6df1d40ad2ce909d02c92cc44c9100de2a9b38ad8746fda72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page