You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
665 B
27 lines
665 B
#!/usr/bin/env python3 |
|
import time |
|
import sys |
|
import re |
|
from mcrcon import MCRcon |
|
import pdb |
|
from CONFIG import HOST,PW,PORT |
|
|
|
flushed=False |
|
with MCRcon(HOST, PW, port=PORT) as mcr: |
|
resp = mcr.command("list uuids") |
|
resp = resp.split(":") |
|
player_list = resp[1].strip().split(",") |
|
player_list = list(map(lambda x: x.strip(), player_list)) |
|
|
|
count_regex = re.match("There are ([0-9]+) of a max of ([0-9]+) players online", resp[0]) |
|
num_players = count_regex.group(1) |
|
max_players = count_regex.group(2) |
|
print("Current # players:", num_players) |
|
print("Max # players:", max_players) |
|
print(player_list) |
|
pdb.set_trace() |
|
|
|
if flushed: |
|
sys.exit(0) |
|
else: |
|
sys.exit(1)
|
|
|