Few updates to MC bedrock ping

This commit is contained in:
Andrew 2022-02-28 22:57:16 -05:00
parent 3c48364998
commit fbe9a7659d

View File

@ -170,16 +170,17 @@ class Stats:
except Exception as e: except Exception as e:
server_icon = False server_icon = False
logger.info(f"Unable to read the server icon : {e}") logger.info(f"Unable to read the server icon : {e}")
print('in raw stats')
ping_data = { ping_data = {
'online': ping_obj['server_player_count'], 'online': ping_obj['server_player_count'],
'max': ping_obj['server_player_max'], 'max': ping_obj['server_player_max'],
'players': online_stats.get('players', 0), 'players': 0,
'server_description': ping_obj['server_edition'], 'server_description': ping_obj['server_edition'],
'server_version': ping_obj['server_version_name'], 'server_version': ping_obj['server_version_name'],
'server_icon': server_icon 'server_icon': server_icon
} }
return ping_data return ping_data
def get_server_players(self, server_id): def get_server_players(self, server_id):
@ -359,7 +360,7 @@ class Stats:
server_icon = False server_icon = False
logger.info(f"Unable to read the server icon : {e}") logger.info(f"Unable to read the server icon : {e}")
print(ping_data)
server_stats = { server_stats = {
'id': server_id, 'id': server_id,
@ -372,11 +373,11 @@ class Stats:
'world_size': self.get_world_size(world_path), 'world_size': self.get_world_size(world_path),
'server_port': server_port, 'server_port': server_port,
'int_ping_results': int_data, 'int_ping_results': int_data,
'online': ping_data['server_player_count'], 'online': ping_data['online'],
'max': ping_data['server_player_max'], 'max': ping_data['max'],
'players': 0, 'players': 0,
'server_description': ping_data['server_edition'], 'server_description': ping_data['server_description'],
'server_version': ping_data['server_version_name'], 'server_version': ping_data['server_version'],
'server_icon': server_icon 'server_icon': server_icon
} }
else: else: