From 26180150b13fe9d485903c2ce6abb09289ba5316 Mon Sep 17 00:00:00 2001 From: Thorinwasher Date: Fri, 9 Apr 2021 09:37:09 +0200 Subject: [PATCH] Improved Data sent to client Looks better, but you can't wrap your head around why by some reason... --- config.yml | 4 ++-- pha_json.py | 10 +++++++++- pha_logging.py | 8 +++----- phantom.py | 4 +--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/config.yml b/config.yml index 4cac4a0..361a484 100644 --- a/config.yml +++ b/config.yml @@ -33,7 +33,7 @@ serverInfo: port: 25565 # What should the broadcast sent to players look like (number from one to three)? -Style: 1 +Style: 2 # Option One: # Upper Message ꖦ # ████ Lower Message ⡏ Hover Message ⢹ @@ -81,4 +81,4 @@ Logging: storeUsers: true -debug: true +debug: false diff --git a/pha_json.py b/pha_json.py index a639adc..d1d7168 100644 --- a/pha_json.py +++ b/pha_json.py @@ -15,6 +15,10 @@ def __init__(self,config,logger): self.Content = config["Content"] self.Style = config["Style"] self.load_base64() + self.UUIDlist = [ + "d2b440c3-edde-4443-899e-6825c31d0919", + "b2957bef-7e6e-4872-b01e-6873034a535a" + ] self.create_Response_dictionary() self.disconnect_dictionary = {"text":self.Content["kickMessage"]} def fix_coloring(self,text): @@ -35,9 +39,13 @@ def create_Response_dictionary(self): virtual_Playernames = re.split("\n", self.Content["hoverMessage"]) virtual_players = [] + index = 0 for playername in virtual_Playernames: - playerDict = {"name":self.fix_coloring(playername),"id": "4566e69f-c907-48ee-8d71-d7ba5aa00d20"} + if index >= len(self.UUIDlist): + index = 0 + playerDict = {"name":self.fix_coloring(playername),"id": self.UUIDlist[index]} virtual_players.append(playerDict) + index += 1 diff --git a/pha_logging.py b/pha_logging.py index eb2881f..555e4fe 100644 --- a/pha_logging.py +++ b/pha_logging.py @@ -49,13 +49,11 @@ def __init__(self,version,config): row1 = "----------------------\n" row2 = "| Phantom server |\n" row3 = "| Version " + version + generate_n_char(9-len(version)," ")+"|\n" - row4 = "----------------------" - msg = row1 + row2 + row3 + row4 + row4 = "----------------------\n" + row5 = "[debug = " + str(self.is_debug) + ", style = " + str(config["Style"])+"]\n" + msg = row1 + row2 + row3 + row4 + row5 print (msg) self.write_to_file(msg) - msg = "[debug = " + str(self.is_debug) + ", style = " + str(config["Style"])+"]\n" - print(msg) - self.write_to_file(msg) def info(self,*msg): end_msg = "["+ write_time() +" INFO ]" + list_to_string(msg) diff --git a/phantom.py b/phantom.py index 68fb68b..1fbf370 100644 --- a/phantom.py +++ b/phantom.py @@ -49,12 +49,10 @@ def __init__(self): self.json_creator = json_creator(self.config,self.logger) self.host = self.config["serverInfo"]["host"] self.port = self.config["serverInfo"]["port"] + """ @return True if successfull, False otherwise """ - - - def get_config(self): if path.exists("config.yml"): return self.load_config()