Skip to content

Commit

Permalink
Same
Browse files Browse the repository at this point in the history
  • Loading branch information
FewerElk authored Aug 12, 2024
1 parent 4a3bfbd commit 834be85
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ def generate(self, level, force=False):
self.data.append(c4)
self.spawn_coord = {"x": 8, "y": 8, "y": 8}

def setblock(self, x:int, y:int, z:int, id:int, nbt:str=""):
def setblock(self, x: int, y: int, z: int, id: int, nbt: str=""):
"""Modify a block into the world.
Args:
- x (int): the x coordinate of the block
Expand Down Expand Up @@ -1096,7 +1096,7 @@ def find_chunk_index(self, x, y, z):
break
return i

def _block_to_chunk_coords(self, x:int, y:int, z:int):
def _block_to_chunk_coords(self, x: int, y: int, z: int):
"""Convert a block coord to a chunk coord. Args: the coordinates. Return the chunk coords."""
nx = x // 16
ny = y // 16
Expand Down Expand Up @@ -1178,7 +1178,7 @@ def save(self):
file.write(dt)
log("Saved !")

def encode(self, data:list):
def encode(self, data: list):
"""Encode the world that will be saved.
Arg:
- data: (list) the data to encode.
Expand All @@ -1201,46 +1201,43 @@ def encode(self, data:list):

return final


def generate(self):
...


########################################################################################################################################################################################################################
########################################################################################################################################################################################################################
########################################################################################################################################################################################################################
class Translation(object):
def __init__(self, lang):
self.lang = lang


def en(self, key):
"""English translation"""
dico = {"disconnect.default": "Disconnected.",
dico = {"disconnect.default": "Disconnected.",
"disconnect.server_full": "Server full.",
"disconnect.not_premium": "Auth failed : user not premium.",
"disconnect.bad_protocol": "Please to connect with an other version : protocol not compatible.",
"disconnect.server_closed": "Server closed.",
"disconnect.not_premium": "Auth failed : user not premium.",
"disconnect.bad_protocol": "Please to connect with an other version : protocol not compatible.",
"disconnect.server_closed": "Server closed.",
"disconnect.server_crashed": "Server crashed indeed of a critical error."}
return dico[key]

def fr(self, key):
"""French translation"""
dico = {"disconnect.default": "Déconnecté",
dico = {"disconnect.default": "Déconnecté",
"disconnect.server_full": "Le serveur est plein.",
"disconnect.not_premium": "L'authentification a échouée : utilisateur non premium.",
"disconnect.bad_protocol": "Merci de se connecter avec une autre version : protocole incompatioble.",
"disconnect.server_closed": "Serveur fermé.",
"disconnect.not_premium": "L'authentification a échouée : utilisateur non premium.",
"disconnect.bad_protocol": "Merci de se connecter avec une autre version : protocole incompatioble.",
"disconnect.server_closed": "Serveur fermé.",
"disconnect.server_crashed": "Le serveur a planté suite à une erreur critique."}
return dico[key]

def es(self, key):
"""Espagnol translation""" #TODO
dico = {"disconnect.default": "Disconnected.",
"disconnect.server_full": "Server full.",
"disconnect.not_premium": "Auth failed : user not premium.",
"disconnect.bad_protocol": "Please to connect with an other version : protocol not compatible.",
"disconnect.server_closed": "Server closed.",
"disconnect.not_premium": "Auth failed : user not premium.",
"disconnect.bad_protocol": "Please to connect with an other version : protocol not compatible.",
"disconnect.server_closed": "Server closed.",
"disconnect.server_crashed": "Server crashed indeed of a critical error."}
return dico[key]

Expand All @@ -1261,7 +1258,7 @@ def key(self, key):
########################################################################################################################################################################################################################
########################################################################################################################################################################################################################
########################################################################################################################################################################################################################
#Exception class
# Exception class
class RequestAnalyseException(Exception):
"""Exception when analysing a request"""
pass
Expand All @@ -1271,8 +1268,8 @@ class TwoPlayerWithSameUsernameException(Exception):

class Command(object):
def __init__(self, command: str, source: Client, server: MCServer):
self.COMMANDS = {"/msg": self.msg,
"/tell": self.msg,
self.COMMANDS = {"/msg": self.msg,
"/tell": self.msg,
"/stop":self.stop} # other will be added later

self.srv = server
Expand Down Expand Up @@ -1324,13 +1321,15 @@ def stop(self, args):
self.srv.stop()
return True


class ConsoleGUI(object):
def __init__(self):
...

def mainthread(self):
...


# PRE MAIN INSTRUCTIONS
be_ready_to_log()

Expand Down

0 comments on commit 834be85

Please sign in to comment.