Fix HEntity's HGender parser

* Exceptions like: No enum constant gearth.extensions.parsers.HGender.m appeared when trying to parse an HEntity, adding a proper HGender parser seems to solve the problem
This commit is contained in:
Eduardo Alonso 2019-01-19 01:53:10 +01:00 committed by Andrej Varga
parent 459f07e126
commit 7f4f73603d
2 changed files with 9 additions and 1 deletions

View File

@ -29,7 +29,7 @@ public class HEntity {
switch (entityTypeId) {
case 1:
gender = HGender.valueOf(packet.readString());
gender = HGender.fromString(packet.readString());
packet.readInteger();
packet.readInteger();
favoriteGroup = packet.readString();

View File

@ -14,4 +14,12 @@ public enum HGender {
public String toString() {
return id;
}
public static HGender fromString(String text) {
for (HGender g : HGender.values()) {
if (g.toString().toLowerCase().equals(text.toLowerCase()))
return g;
}
return null;
}
}