Skip to content

Commit 28fbb65

Browse files
Resolve Minecraft Protocol issue
Fix TypeError: string indices must be integers, not 'str'
1 parent 75ef9f1 commit 28fbb65

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

opengsq/protocols/minecraft.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ async def get_status(self, version=47, strip_color=True) -> dict[str, Any]:
8383
data["description"]["extra"], list
8484
):
8585
for i, extra in enumerate(data["description"]["extra"]):
86-
if isinstance(extra["text"], str):
86+
if isinstance(extra, str):
87+
data["description"]["extra"][i] = Minecraft.strip_colors(extra)
88+
elif isinstance(extra["text"], str):
8789
data["description"]["extra"][i][
8890
"text"
8991
] = Minecraft.strip_colors(extra["text"])
@@ -171,6 +173,7 @@ def _unpack_varint(self, br: BinaryReader):
171173

172174
async def main_async():
173175
minecraft = Minecraft(host="mc.goldcraft.ir", port=25565, timeout=5.0)
176+
# minecraft = Minecraft(host="xcl.no", port=25565, timeout=5.0)
174177
status = await minecraft.get_status(47, strip_color=True)
175178
print(status)
176179
status_pre17 = await minecraft.get_status_pre17()

opengsq/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.0.7'
1+
__version__ = '3.0.8'

0 commit comments

Comments
 (0)