diff --git a/app/classes/minecraft/mc_ping.py b/app/classes/minecraft/mc_ping.py index 2d34dc71..4a27d686 100644 --- a/app/classes/minecraft/mc_ping.py +++ b/app/classes/minecraft/mc_ping.py @@ -73,7 +73,6 @@ class Player: # For the rest of requests see wiki.vg/Protocol def ping(ip, port): - print("IN PING PORT: " + str(port)) def read_var_int(): i = 0 j = 0 @@ -91,12 +90,10 @@ def ping(ip, port): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: - print("SOCKET PORT: " + str(port)) - sock.connect((ip, int(port))) + sock.connect((ip, port)) - except: + except socket.error as err: pass - print('FALSE 1') return False try: @@ -112,10 +109,8 @@ def ping(ip, port): length = read_var_int() # full packet length if length < 10: if length < 0: - print("LEN < 0 FALSE") return False else: - print("FALSE 2") return False sock.recv(1) # packet type, 0 for pings @@ -124,12 +119,10 @@ def ping(ip, port): while len(data) != length: chunk = sock.recv(length - len(data)) if not chunk: - print("NOT CHUNK FALSE") return False data += chunk logger.debug("Server reports this data on ping: {}".format(data)) - print("Server reports this data on ping: {}".format(data)) return Server(json.loads(data)) finally: sock.close() diff --git a/app/classes/minecraft/stats.py b/app/classes/minecraft/stats.py index 4c90aef2..1b52e728 100644 --- a/app/classes/minecraft/stats.py +++ b/app/classes/minecraft/stats.py @@ -198,6 +198,7 @@ class Stats: # get our server object, settings and data dictionaries server_obj = s.get('server_obj', None) + server_obj.reload_server_settings() server_settings = s.get('server_settings', {}) server_data = s.get('server_data_obj', {}) @@ -212,15 +213,14 @@ class Stats: internal_ip = server_data.get('server-ip', "127.0.0.1") server_port = server_settings.get('server-port', "25565") - print(str(server_port)) - - print("Pinging {} on port {}".format(internal_ip, server_port)) + for item in server_data: + if item is not list: + print(str(item)) + print("Server IP: " + internal_ip) logger.debug("Pinging {} on port {}".format(internal_ip, server_port)) int_mc_ping = ping(internal_ip, int(server_port)) - print("PING: " + str(int_mc_ping)) - int_data = False ping_data = {} @@ -246,7 +246,6 @@ class Stats: 'desc': ping_data.get("server_description", False), 'version': ping_data.get("server_version", False) } - print("SERVER STATS LIST LEN(" + str(len(server_stats_list)) + "): ") # add this servers data to the stack server_stats_list.append(server_stats) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 6f5c27ec..2b259a8e 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -48,6 +48,8 @@ class Server: def reload_server_settings(self): server_data = db_helper.get_server_data_by_id(self.server_id) + for item in server_data: + print("ITEM: " + str(item)) self.settings = server_data def do_server_setup(self, server_data_obj): @@ -234,7 +236,6 @@ class Server: def check_running(self): running = False - # if process is None, we never tried to start if self.PID is None: return running diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 8241c7f3..99071ee3 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -324,7 +324,7 @@ class PanelHandler(BaseHandler): user_data = json.loads(self.get_secure_cookie("user_data")) exec_user = db_helper.get_user(user_data['user_id']) - if not exec_user.superuser: + if not exec_user['superuser']: self.redirect("/panel/error?error=Unauthorized access: not superuser") return False elif server_id is None: