Skip to content

Commit

Permalink
Fix identification of chatcomponent in older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pokechu22 committed Nov 12, 2020
1 parent d3f944e commit 278e75e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions burger/toppings/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ def identify(classloader, path, verbose):
# As of 20w17a, there is another interface in the middle that we don't
# want, but the interface we do want extends Brigadier's Message interface.
# So, loop up until a good-looking interface is present.
while len(class_file.interfaces) == 1:
# In other versions, the interface extends Iterable. In some versions, it extends both.
while len(class_file.interfaces) in (1, 2):
parent = class_file.interfaces[0].name.value
if "com/mojang/brigadier" in parent:
if "com/mojang/brigadier" in parent or "java/lang/Iterable" == parent:
break
class_file = classloader[parent]
else:
Expand Down

0 comments on commit 278e75e

Please sign in to comment.