mcpyproject / McPy

A open source Minecraft server written 100% in Python
GNU Affero General Public License v3.0
84 stars 15 forks source link

Ping Issue #50

Closed ngi-odoo closed 3 years ago

ngi-odoo commented 3 years ago

Describe the bug When pinging the server with version 1.15.2 or 1.16.4, an error is displayed on the server

To Reproduce Steps to reproduce the behavior:

  1. Launch Minecraft 1.15.2
  2. Go to Multiplayer
  3. An error is displayed on the server

Expected behavior No error

Error This error occures when pinging with 1.16.4 (Error from @Geolykt)

PlayerNetwork{127.0.0.1} | ERROR | No name known for packet: (754, 'status', 'upstream', 0)
Traceback (most recent call last):
  File "/home/Geolykt/.local/lib/python3.9/site-packages/quarry/net/protocol.py", line 207, in get_packet_name
    return packets.packet_names[key]
KeyError: (754, 'status', 'upstream', 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/Geolykt/.local/lib/python3.9/site-packages/quarry/net/protocol.py", line 243, in data_received
    name = self.get_packet_name(buff.unpack_varint())
  File "/home/Geolykt/.local/lib/python3.9/site-packages/quarry/net/protocol.py", line 209, in get_packet_name
    raise ProtocolError("No name known for packet: %s" % (key,))
quarry.net.protocol.ProtocolError: No name known for packet: (754, 'status', 'upstream', 0)

Host system:

Additional context Maybe a quarry issue ?

0ddlyoko commented 3 years ago

It looks like 1.16.4 is not supported, I've opened a ticket to quarry: https://github.com/barneygale/quarry/issues/102

Geolykt commented 3 years ago

The error quoted was occurring on Fedora 33 (GNU/Linux), but that's what I've been thinking too.

Geolykt commented 3 years ago

The issue is inherent in the structure of the project (quarry) but I believe with some overloading this should be fixable

hydrostaticcog commented 3 years ago

Agreed

Geolykt commented 3 years ago

This is actually a bit harder than I thought it would be. While I fixed it by changing the implementation of two methods in quarry's protocol.py to


    def get_packet_name(self, ident):
        protver = self.protocol_version
        if self.protocol_mode == 'status':
            protver = 578
        key = (protver, self.protocol_mode, self.recv_direction,
               ident)
        try:
            return packets.packet_names[key]
        except KeyError:
            raise ProtocolError("No name known for packet: %s" % (key,))

    def get_packet_ident(self, name):
        protver = self.protocol_version
        if self.protocol_mode == 'status':
            protver = 578
        key = (protver, self.protocol_mode, self.send_direction,
               name)
        try:
            return packets.packet_idents[key]
        except KeyError:
            raise ProtocolError("No ID known for packet: %s" % (key,))

this is not a viable approach as it would mean that we will need to fork Quarry or push a PR to change that code, but I doubt they will accept such a PR. Does anyone have a better idea on how to go about it?