def broadcast(self, message, who="@a"): """Broadcasts the specified message to all clients connected. message can be a JSON chat object, or a string with formatting codes using the § as a prefix. """ if isinstance(message, dict): if self.version_compute < 10700: self.console("say %s %s" % (who, chattocolorcodes(message))) else: encoding = self.wrapper.encoding self.console("tellraw %s %s" % ( who, json.dumps(message, ensure_ascii=False))) else: if self.version_compute < 10700: temp = processcolorcodes(message) self.console("say %s %s" % ( who, chattocolorcodes(json.loads(temp)))) else: self.console("tellraw %s %s" % ( who, processcolorcodes(message)))
def broadcast(self, message, who="@a"): """Broadcasts the specified message to all clients connected. message can be a JSON chat object, or a string with formatting codes using the § as a prefix. """ if isinstance(message, dict): if self.vitals.version_compute < 10700: self.console("say %s %s" % (who, chattocolorcodes(message))) else: encoding = self.wrapper.encoding self.console("tellraw %s %s" % ( who, json.dumps(message, ensure_ascii=False))) else: if self.vitals.version_compute < 10700: temp = processcolorcodes(message) self.console("say %s %s" % ( who, chattocolorcodes(json.loads(temp)))) else: self.console("tellraw %s %s" % ( who, processcolorcodes(message)))