Add support for Minecraft pre-release 16w36a (protocol 305).
Add max_length property to ChatPacket.
This commit is contained in:
1 parent
41394126ab
commit
c4ed8e6d68
2 files changed
+17
-3
No files matched your search
@@ -86,9 +86,12 @@ class Packet(object):
|
||||
@context.setter
|
||||
def context(self, _context):
|
||||
self._context = _context
|
||||
if _context is not None:
|
||||
self.id = self.get_id(_context)
|
||||
self.definition = self.get_definition(_context)
|
||||
self._context_changed()
|
||||
|
||||
def _context_changed(self):
|
||||
if self._context is not None:
|
||||
self.id = self.get_id(self._context)
|
||||
self.definition = self.get_definition(self._context)
|
||||
else:
|
||||
self.id = None
|
||||
self.definition = None
|
||||
@@ -700,6 +703,16 @@ class ChatPacket(Packet):
|
||||
return 0x02 if context.protocol_version >= 107 else \
|
||||
0x01
|
||||
|
||||
@staticmethod
|
||||
def get_max_length(context):
|
||||
return 256 if context.protocol_version >= 305 else \
|
||||
100
|
||||
|
||||
@property
|
||||
def max_length(self):
|
||||
if self.context is not None:
|
||||
return self.get_max_length(self.context)
|
||||
|
||||
packet_name = "chat"
|
||||
definition = [
|
||||
{'message': String}]
|
||||
|
||||
Reference in new issue
Block a user