Skip to content

Commit

Permalink
Resolve Minecraft Protocol issue
Browse files Browse the repository at this point in the history
Fix TypeError: string indices must be integers, not 'str'
  • Loading branch information
BattlefieldDuck committed Feb 6, 2024
1 parent 75ef9f1 commit 28fbb65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion opengsq/protocols/minecraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ async def get_status(self, version=47, strip_color=True) -> dict[str, Any]:
data["description"]["extra"], list
):
for i, extra in enumerate(data["description"]["extra"]):
if isinstance(extra["text"], str):
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"])
Expand Down Expand Up @@ -171,6 +173,7 @@ def _unpack_varint(self, br: BinaryReader):

async def main_async():
minecraft = Minecraft(host="mc.goldcraft.ir", port=25565, timeout=5.0)
# minecraft = Minecraft(host="xcl.no", port=25565, timeout=5.0)
status = await minecraft.get_status(47, strip_color=True)
print(status)
status_pre17 = await minecraft.get_status_pre17()
Expand Down
2 changes: 1 addition & 1 deletion opengsq/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.7'
__version__ = '3.0.8'

0 comments on commit 28fbb65

Please sign in to comment.