Skip to content

Commit

Permalink
Resolve Minecraft Protocol issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BattlefieldDuck committed Feb 7, 2024
1 parent d3a55fa commit 35a0598
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions opengsq/protocols/minecraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,26 @@ async def get_status(self, version=47, strip_color=True) -> dict[str, Any]:

if isinstance(data["description"], str):
data["description"] = Minecraft.strip_colors(data["description"])
else:
if "text" in data["description"] and isinstance(
data["description"]["text"], str
):
data["description"]["text"] = Minecraft.strip_colors(
data["description"]["text"]
)

if "text" in data["description"] and isinstance(
data["description"]["text"], str
):
data["description"]["text"] = Minecraft.strip_colors(
data["description"]["text"]
)

if "extra" in data["description"] and isinstance(
data["description"]["extra"], list
):
for i, extra in enumerate(data["description"]["extra"]):
if isinstance(extra, str):
data["description"]["extra"][i] = Minecraft.strip_colors(extra)
elif isinstance(extra["text"], str):
data["description"]["extra"][i][
"text"
] = Minecraft.strip_colors(extra["text"])
if "extra" in data["description"] and isinstance(
data["description"]["extra"], list
):
for i, extra in enumerate(data["description"]["extra"]):
if isinstance(extra, str):
data["description"]["extra"][i] = Minecraft.strip_colors(
extra
)
elif isinstance(extra["text"], str):
data["description"]["extra"][i]["text"] = (
Minecraft.strip_colors(extra["text"])
)

return data

Expand Down

0 comments on commit 35a0598

Please sign in to comment.