From 45a1f65748f9722fa6f481dd149e41759424d7ea Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Sun, 16 Feb 2014 17:26:53 +1300 Subject: [PATCH] fixed up mcping --- plugins/minecraft_ping.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/minecraft_ping.py b/plugins/minecraft_ping.py index d746f44..ea254dc 100644 --- a/plugins/minecraft_ping.py +++ b/plugins/minecraft_ping.py @@ -76,13 +76,16 @@ def mcping_modern(host, port): data = json.loads(d.decode('utf8')) try: version = data["version"]["name"] - desc = data["description"] + if data["description"].get("text", None): + desc = u" ".join(data["description"]["text"].split()) + else: + desc = u" ".join(data["description"].split()) max_players = data["players"]["max"] online = data["players"]["online"] except Exception as e: return "Invalid data: {}; error: {}".format(data, e) - return mc_color_format(u"{}\x0f - {}\x0f - {}/{} players *".format(desc, version, online, - max_players)).replace("\n", u"\x0f - ") + return mc_color_format(u"{}\x0f - {}\x0f - {}/{} players.".format(desc, version, online, + max_players)).replace("\n", u"\x0f - ") def mcping_legacy(host, port):