2022-07-01 14:28:39 +04:00
|
|
|
"""Aternos Minecraft server"""
|
|
|
|
|
2023-05-24 18:09:37 +04:00
|
|
|
import re
|
2022-08-22 09:55:08 +04:00
|
|
|
|
2023-05-24 18:09:37 +04:00
|
|
|
import enum
|
2023-08-10 16:25:31 +04:00
|
|
|
from typing import List
|
2021-10-08 19:35:20 +04:00
|
|
|
|
2023-08-10 16:25:31 +04:00
|
|
|
from .atselenium import SeleniumHelper
|
2023-05-24 17:41:33 +04:00
|
|
|
|
2023-08-10 16:25:31 +04:00
|
|
|
from .atconnect import AJAX_URL
|
2023-05-24 17:41:33 +04:00
|
|
|
|
2023-08-10 16:25:31 +04:00
|
|
|
from .atstubs import PlayersList
|
|
|
|
from .atstubs import Lists
|
|
|
|
|
|
|
|
from .atstubs import FileManager
|
|
|
|
from .atstubs import AternosConfig
|
2023-05-24 17:41:33 +04:00
|
|
|
|
|
|
|
from .aterrors import ServerStartError
|
2021-10-15 15:12:45 +04:00
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
|
2023-08-10 16:25:31 +04:00
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
|
2023-05-29 11:44:19 +04:00
|
|
|
SERVER_URL = f'{AJAX_URL}/server'
|
2023-05-24 18:09:37 +04:00
|
|
|
status_re = re.compile(
|
|
|
|
r'<script>\s*var lastStatus\s*?=\s*?(\{.+?\});?\s*<\/script>'
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-03-18 18:38:36 +04:00
|
|
|
class Edition(enum.IntEnum):
|
2022-06-16 15:40:10 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Server edition type enum (java, bedrock)"""
|
2022-06-23 15:13:56 +04:00
|
|
|
|
|
|
|
java = 0
|
|
|
|
bedrock = 1
|
2022-06-16 15:40:10 +04:00
|
|
|
|
2021-10-15 15:12:45 +04:00
|
|
|
|
2022-01-11 18:08:59 +04:00
|
|
|
class Status(enum.IntEnum):
|
2022-06-16 15:40:10 +04:00
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
"""Server numeric status enum.
|
|
|
|
It is highly recommended to use
|
|
|
|
`AternosServer.status` instead of
|
|
|
|
`AternosServer.status_num`"""
|
|
|
|
|
|
|
|
off = 0
|
|
|
|
on = 1
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
starting = 2
|
|
|
|
shutdown = 3
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
|
|
|
|
loading = 6
|
2022-06-23 15:13:56 +04:00
|
|
|
error = 7
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
|
|
|
|
preparing = 10
|
2022-06-23 15:13:56 +04:00
|
|
|
confirm = 10
|
2022-06-16 15:40:10 +04:00
|
|
|
|
2021-10-08 19:35:20 +04:00
|
|
|
|
2023-05-29 11:44:19 +04:00
|
|
|
|
2023-08-10 16:25:31 +04:00
|
|
|
@dataclass
|
|
|
|
class PartialServerInfo:
|
|
|
|
se: SeleniumHelper
|
2024-02-15 17:29:32 +04:00
|
|
|
id: str
|
|
|
|
name: str = ''
|
|
|
|
software: str = ''
|
|
|
|
status: str = ''
|
|
|
|
players: int = 0
|
2023-05-29 11:44:19 +04:00
|
|
|
|
2023-08-10 16:25:31 +04:00
|
|
|
def use(self) -> None:
|
|
|
|
self.se.set_cookie('ATERNOS_SERVER', self.id)
|
|
|
|
self.se.load_page('/server')
|
2022-06-23 15:13:56 +04:00
|
|
|
|
|
|
|
|
2023-08-10 16:25:31 +04:00
|
|
|
@dataclass
|
|
|
|
class AternosServer:
|
|
|
|
"""Class for controlling your Aternos Minecraft server"""
|
2022-06-23 15:13:56 +04:00
|
|
|
|
2022-07-01 14:28:39 +04:00
|
|
|
def start(
|
|
|
|
self,
|
|
|
|
headstart: bool = False,
|
2023-05-29 11:44:19 +04:00
|
|
|
access_credits: bool = False,
|
2022-07-01 14:28:39 +04:00
|
|
|
accepteula: bool = True) -> None:
|
2022-06-23 15:13:56 +04:00
|
|
|
"""Starts a server
|
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Args:
|
|
|
|
headstart (bool, optional): Start a server in
|
|
|
|
the headstart mode which allows
|
|
|
|
you to skip all queue
|
2023-05-29 11:44:19 +04:00
|
|
|
access_credits (bool, optional):
|
|
|
|
Some new parameter in Aternos API,
|
|
|
|
I don't know what it is
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
accepteula (bool, optional):
|
|
|
|
Automatically accept the Mojang EULA
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
ServerStartError: When Aternos
|
|
|
|
is unable to start the server
|
2022-06-23 15:13:56 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
startreq = self.atserver_request(
|
2023-05-29 11:44:19 +04:00
|
|
|
f'{SERVER_URL}/start',
|
|
|
|
'GET', params={
|
|
|
|
'headstart': int(headstart),
|
|
|
|
'access-credits': int(access_credits),
|
|
|
|
},
|
|
|
|
sendtoken=True,
|
2022-06-23 15:13:56 +04:00
|
|
|
)
|
|
|
|
startresult = startreq.json()
|
2022-06-16 15:40:10 +04:00
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
if startresult['success']:
|
|
|
|
return
|
2022-07-01 10:31:23 +04:00
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
error = startresult['error']
|
2021-10-08 19:35:20 +04:00
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
if error == 'eula' and accepteula:
|
|
|
|
self.eula()
|
2022-07-01 14:28:39 +04:00
|
|
|
self.start(accepteula=False)
|
|
|
|
return
|
2022-07-01 10:31:23 +04:00
|
|
|
|
|
|
|
raise ServerStartError(error)
|
2022-01-11 18:08:59 +04:00
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
def confirm(self) -> None:
|
|
|
|
"""Confirms server launching"""
|
|
|
|
|
|
|
|
self.atserver_request(
|
2023-05-29 11:44:19 +04:00
|
|
|
f'{SERVER_URL}/confirm',
|
|
|
|
'GET', sendtoken=True,
|
2022-06-23 15:13:56 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
def stop(self) -> None:
|
|
|
|
"""Stops the server"""
|
|
|
|
|
|
|
|
self.atserver_request(
|
2023-05-29 11:44:19 +04:00
|
|
|
f'{SERVER_URL}/stop',
|
|
|
|
'GET', sendtoken=True,
|
2022-06-23 15:13:56 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
def cancel(self) -> None:
|
|
|
|
"""Cancels server launching"""
|
|
|
|
|
|
|
|
self.atserver_request(
|
2023-05-29 11:44:19 +04:00
|
|
|
f'{SERVER_URL}/cancel',
|
|
|
|
'GET', sendtoken=True,
|
2022-06-23 15:13:56 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
def restart(self) -> None:
|
|
|
|
"""Restarts the server"""
|
|
|
|
|
|
|
|
self.atserver_request(
|
2023-05-29 11:44:19 +04:00
|
|
|
f'{SERVER_URL}/restart',
|
|
|
|
'GET', sendtoken=True,
|
2022-06-23 15:13:56 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
def eula(self) -> None:
|
2023-05-29 11:44:19 +04:00
|
|
|
"""Sends a request to accept the Mojang EULA"""
|
2022-06-23 15:13:56 +04:00
|
|
|
|
|
|
|
self.atserver_request(
|
2023-05-29 11:44:19 +04:00
|
|
|
f'{SERVER_URL}/accept-eula',
|
|
|
|
'GET', sendtoken=True,
|
2022-06-23 15:13:56 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
def files(self) -> FileManager:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Returns FileManager instance
|
|
|
|
for file operations
|
2022-06-23 15:13:56 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
FileManager object
|
2022-06-23 15:13:56 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
return FileManager(self)
|
|
|
|
|
|
|
|
def config(self) -> AternosConfig:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Returns AternosConfig instance
|
|
|
|
for editing server settings
|
2022-06-23 15:13:56 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
AternosConfig object
|
2022-06-23 15:13:56 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
return AternosConfig(self)
|
|
|
|
|
|
|
|
def players(self, lst: Lists) -> PlayersList:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Returns PlayersList instance
|
|
|
|
for managing operators, whitelist
|
|
|
|
and banned players lists
|
2022-06-23 15:13:56 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Args:
|
|
|
|
lst (Lists): Players list type,
|
|
|
|
must be the atplayers.Lists enum value
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
PlayersList object
|
2022-06-23 15:13:56 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
return PlayersList(lst, self)
|
|
|
|
|
2023-05-29 11:44:19 +04:00
|
|
|
def set_subdomain(self, value: str) -> None:
|
|
|
|
"""Set a new subdomain for your server
|
|
|
|
(the part before `.aternos.me`)
|
2022-06-23 15:13:56 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Args:
|
2023-05-29 11:44:19 +04:00
|
|
|
value (str): Subdomain
|
|
|
|
"""
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
|
2023-05-29 11:44:19 +04:00
|
|
|
self.atserver_request(
|
|
|
|
f'{SERVER_URL}/options/set-subdomain',
|
|
|
|
'GET', params={'subdomain': value},
|
|
|
|
sendtoken=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
def set_motd(self, value: str) -> None:
|
|
|
|
"""Set new Message of the Day
|
|
|
|
(shown below the name in the Minecraft servers list).
|
|
|
|
Formatting with "paragraph sign + code" is supported,
|
|
|
|
see https://minecraft.tools/color-code.php
|
|
|
|
|
|
|
|
Args:
|
|
|
|
value (str): MOTD
|
2022-06-23 15:13:56 +04:00
|
|
|
"""
|
|
|
|
|
2023-05-29 11:44:19 +04:00
|
|
|
self.atserver_request(
|
|
|
|
f'{SERVER_URL}/options/set-motd',
|
|
|
|
'POST', data={'motd': value},
|
|
|
|
sendtoken=True,
|
2022-06-23 15:13:56 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def subdomain(self) -> str:
|
2023-05-29 11:44:19 +04:00
|
|
|
"""Get the server subdomain
|
|
|
|
(the part before `.aternos.me`)
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Subdomain
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
atdomain = self.domain
|
|
|
|
return atdomain[:atdomain.find('.')]
|
|
|
|
|
|
|
|
@property
|
|
|
|
def motd(self) -> str:
|
2023-05-29 11:44:19 +04:00
|
|
|
"""Get the server message of the day
|
|
|
|
(shown below its name in Minecraft servers list)
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
MOTD
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return self._info['motd']
|
|
|
|
|
|
|
|
@property
|
|
|
|
def address(self) -> str:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Full server address
|
|
|
|
including domain and port
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Server address
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-12-27 16:55:19 +04:00
|
|
|
return f'{self.domain}:{self.port}'
|
2022-06-23 15:13:56 +04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def domain(self) -> str:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Server domain (e.g. `test.aternos.me`).
|
|
|
|
In other words, address without port number
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Domain
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return self._info['ip']
|
|
|
|
|
|
|
|
@property
|
|
|
|
def port(self) -> int:
|
2022-07-01 14:28:39 +04:00
|
|
|
"""Server port number
|
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Port
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return self._info['port']
|
|
|
|
|
|
|
|
@property
|
2022-07-01 14:28:39 +04:00
|
|
|
def edition(self) -> Edition:
|
|
|
|
"""Server software edition: Java or Bedrock
|
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Software edition
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
soft_type = self._info['bedrock']
|
2022-07-01 14:28:39 +04:00
|
|
|
return Edition(soft_type)
|
2022-06-23 15:13:56 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
@property
|
|
|
|
def is_java(self) -> bool:
|
|
|
|
"""Check if server software is Java Edition
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Is it Minecraft JE
|
|
|
|
"""
|
|
|
|
|
|
|
|
return not self._info['bedrock']
|
|
|
|
|
|
|
|
@property
|
|
|
|
def is_bedrock(self) -> bool:
|
|
|
|
"""Check if server software is Bedrock Edition
|
|
|
|
|
|
|
|
Returns:
|
2022-09-20 20:06:12 +03:00
|
|
|
Is it Minecraft BE
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
return bool(self._info['bedrock'])
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
@property
|
|
|
|
def software(self) -> str:
|
2022-07-01 14:28:39 +04:00
|
|
|
"""Server software name (e.g. `Vanilla`)
|
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Software name
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return self._info['software']
|
|
|
|
|
|
|
|
@property
|
|
|
|
def version(self) -> str:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Server software version (1.16.5)
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Software version
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return self._info['version']
|
|
|
|
|
|
|
|
@property
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
def css_class(self) -> str:
|
2023-05-29 11:44:19 +04:00
|
|
|
"""CSS class for the server status element
|
|
|
|
on official web site: offline, online, loading, etc.
|
|
|
|
See https://aternos.dc09.ru/howto/server/#server-info
|
|
|
|
|
|
|
|
In most cases you need `AternosServer.status` instead of this
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
CSS class
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return self._info['class']
|
|
|
|
|
|
|
|
@property
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
def status(self) -> str:
|
|
|
|
"""Server status string
|
|
|
|
(offline, loading, preparing)
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Status string
|
|
|
|
"""
|
|
|
|
|
|
|
|
return self._info['lang']
|
|
|
|
|
|
|
|
@property
|
|
|
|
def status_num(self) -> Status:
|
|
|
|
"""Server numeric status.
|
|
|
|
It is highly recommended to use
|
|
|
|
status string instead of a number
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Status code
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
return Status(self._info['status'])
|
2022-06-23 15:13:56 +04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def players_list(self) -> List[str]:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""List of connected players' nicknames
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Connected players
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return self._info['playerlist']
|
|
|
|
|
|
|
|
@property
|
|
|
|
def players_count(self) -> int:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""How many players are connected
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Connected players count
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return int(self._info['players'])
|
|
|
|
|
|
|
|
@property
|
|
|
|
def slots(self) -> int:
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
"""Server slots, how many
|
|
|
|
players **can** connect
|
2022-07-01 14:28:39 +04:00
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Slots count
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return int(self._info['slots'])
|
|
|
|
|
|
|
|
@property
|
|
|
|
def ram(self) -> int:
|
2022-07-01 14:28:39 +04:00
|
|
|
"""Server used RAM in MB
|
|
|
|
|
MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to.
Readme: centered title + logo, added badges, features list, updated changelog.
Improved Files API, added automatical session saving and restoring to Client.
Some changes in makefile and gitignore.
License Notice now refers to all contributors.
2022-08-26 16:14:07 +04:00
|
|
|
Returns:
|
|
|
|
Used RAM
|
2022-07-01 14:28:39 +04:00
|
|
|
"""
|
|
|
|
|
2022-06-23 15:13:56 +04:00
|
|
|
return int(self._info['ram'])
|
2022-12-23 17:38:51 +04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def countdown(self) -> int:
|
|
|
|
"""Server stop countdown
|
|
|
|
in seconds
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Stop countdown
|
|
|
|
"""
|
|
|
|
|
|
|
|
value = self._info['countdown']
|
|
|
|
return int(value or -1)
|