Skip to content

Commit

Permalink
Improved Data sent to client
Browse files Browse the repository at this point in the history
Looks better, but you can't wrap your head around why by some reason...
  • Loading branch information
Thorinwasher committed Apr 9, 2021
1 parent b4a0cdb commit 2618015
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ⢹
Expand Down Expand Up @@ -81,4 +81,4 @@ Logging:
storeUsers: true


debug: true
debug: false
10 changes: 9 additions & 1 deletion pha_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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



Expand Down
8 changes: 3 additions & 5 deletions pha_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions phantom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2618015

Please sign in to comment.