Skip to content

Commit

Permalink
Merge pull request #30 from Bilbotech/patch-1
Browse files Browse the repository at this point in the history
update headIcon
  • Loading branch information
Ethan-Vann authored Sep 27, 2023
2 parents ed894f2 + 5a1b709 commit 2219c90
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/main/java/com/example/EthanApiPlugin/EthanApiPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,20 @@ public static int pathLength(Player player) {
public static HeadIcon getHeadIcon(NPC npc) {
Method getHeadIconArrayMethod = null;
for (Method declaredMethod : npc.getComposition().getClass().getDeclaredMethods()) {
if (declaredMethod.getReturnType() == short[].class && declaredMethod.getParameterTypes().length == 0&& declaredMethod.getName().length()==2) {
if (declaredMethod.getReturnType() == short[].class && declaredMethod.getParameterTypes().length == 0) {
getHeadIconArrayMethod = declaredMethod;
break;
if (getHeadIconArrayMethod == null) {
continue;
}
getHeadIconArrayMethod.setAccessible(true);
short[] headIconArray = (short[]) getHeadIconArrayMethod.invoke(npc.getComposition());
if (headIconArray == null || headIconArray.length == 0) {
continue;
}
return HeadIcon.values()[headIconArray[0]];
}
}
if (getHeadIconArrayMethod == null) {
return null;
}
getHeadIconArrayMethod.setAccessible(true);
short[] headIconArray = (short[]) getHeadIconArrayMethod.invoke(npc.getComposition());
if (headIconArray == null || headIconArray.length == 0) {
return null;
}
return HeadIcon.values()[headIconArray[0]];
return null;
}

@Deprecated
Expand Down

0 comments on commit 2219c90

Please sign in to comment.