Exemple #1
0
 def __init__(self, withWizard):
     super().__init__()
     self.startTime = time()
     if Utils.getOS() == "windows":
         Utils.enableWindowsFormating()
     if Utils.isPacked():
         print(Utils.getPodrumDir())
         Base.addFromZipDir(Utils.getPodrumDir(), "podrum/lang/languages")
     else:
         Base.addFromDir(Utils.getPodrumDir() + "/" + "podrum/lang/languages")
     if not Utils.checkAllFiles() and withWizard:
         Wizard.start()
         while Wizard.isInWizard:
             pass
     self.config = Utils.getDefaultConfig()
     self.ip = self.config.config["server-ip"]
     self.port = int(self.config.config["server-port"])
     print(str(self.podrumLogo))
     Logger.info(str(Base.getTranslation("startingServer")).replace("{ip}", str(self.ip)).replace("{port}", str(self.port)))
     Logger.info(str(Base.getTranslation("license")))
     RegisterVanilla()
     Plugin.pluginsDir = os.getcwd() + "/plugins"
     Plugin.server = self
     Plugin.loadAll()
     self.endTime = time()
     self.timeDiff = "%.3f" % (self.endTime - self.startTime)
     Logger.info(f'Done in {str(self.timeDiff)}s. Type "help" to view all available commands.')
     CommandReader(self)
     Interface(self.ip, self.port)
     while self.isTicking:
         sleep(self.tickrate)
Exemple #2
0
 def start():
     config = Utils.getDefaultConfig()
     step = 0
     while True:
         if step == 0:
             Base.printLanguages()
             userInput = input("> Please, select a language: ")
             if userInput in Base.languages:
                 config.config["language"] = userInput
                 print("- " + Base.getTranslation("langSelectedAsBase"))
                 step += 1
             else:
                 print("[!] That language does not exists. Please, choose one from the list.")
         elif step == 1:
             print(Wizard.podrumLicense)
             userInput = input("> " + Base.getTranslation("acceptLicense") + ": ")
             if Wizard.checkYesNo(userInput):
                 step += 1
             elif not Wizard.checkYesNo(userInput):
                 print(Base.getTranslation("mustAcceptLicense"))
             elif Wizard.checkYesNo(userInput) is None:
                 print(Base.getTranslation("writeYesOrNo"))
         elif step == 2:
             userInput = input("> " + Base.getTranslation("wizardSetup") + ": ")
             if Wizard.checkYesNo(userInput):
                 step += 1
             elif not Wizard.checkYesNo(userInput):
                 print("> " + Base.getTranslation("wizardSkipped"))
                 Wizard.isInWizard = False
                 config.save()
                 break
         elif step == 3:
             print(Wizard.podrumLogo)
             print(">- Podrum - Wizard -<\n\n")
             step += 1
         elif step == 4:
             userInput = input("[>] " + Base.getTranslation("writeServerPort") + " ")
             if userInput == "":
                 config.config["server-port"] = 19132
                 step += 1
             elif userInput.isdigit():
                 config.config["server-port"] = int(userInput)
                 step += 1
         elif step == 5:
             userInput = input("[>] " + Base.getTranslation("writeMOTD") + " ")
             if(userInput != ""):
                 config.config["motd"] = userInput
                 step += 1
         elif step == 6:
             userInput = input("[>] " + Base.getTranslation("writeGamemode") + " ")
             if userInput.isdigit():
                 if int(userInput) >= 0 and int(userInput) <= 3:
                     config.config["gamemode"] = int(userInput)
                     step += 1
         elif step == 7:
             userInput = input("[>] " + Base.getTranslation("writeMaxPlayers") + " ")
             if userInput.isdigit():
                 config.config["max-players"] = int(userInput)
                 step += 1
         elif step == 8:
             print(Base.getTranslation("wizardFinished"))
             Wizard.isInWizard = False
             config.save()
             break
Exemple #3
0
 def getTranslation(content):
     config = Utils.getDefaultConfig()
     langId = config.config["language"]
     return Base.translate(langId, content)