def run(self): while True: line = input() if line != "": args = line.split() command = args[0] if CommandManager.isCommand(command): CommandManager.commands[command].execute(self.server, args) else: Logger.error(Base.getTranslation("invalidCommand"))
def save(self): try: if self.format == self.formats["json"]: self.file = open(self.file.name , "+w") json.dump(self.config, self.file, indent = 4) elif self.format == self.formats["yaml"]: self.file = open(self.file.name , "+w") yaml.dump(self.config, self.file) elif self.format == self.formats["properties"]: self.file = open(self.file.name , "+w") Properties.dump(self.config, self.file) elif self.format == self.formats["toml"]: self.file = open(self.file.name , "+w") toml.dump(self.config, self.file) elif self.format == self.formats["ini"]: self.file = open(self.file.name , "+w") toml.dump(self.config, self.file) except Exception as e: Logger.error(f"Could not save the config: {self.file.name}") Logger.error(e)