Skip to content

Commit

Permalink
Fix AuraMobsAPI#getMobLevel error
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Jun 29, 2024
1 parent a4ae5ad commit 5f3a203
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/dev/aurelium/auramobs/api/AuraMobsAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ public static int getMobLevel(Entity e) {
if (!plugin.isAuraMob(m)) {
return 1;
}
String persistent = m.getPersistentDataContainer().get(plugin.getMobKey(), PersistentDataType.STRING);
if (persistent == null || persistent.isEmpty()) {
Integer persistent = m.getPersistentDataContainer().get(plugin.getMobKey(), PersistentDataType.INTEGER);
if (persistent == null) {
return 1;
}
return Integer.parseInt(persistent);
return persistent;
}

public static boolean isAuraMob(Entity entity) {
if (!(entity instanceof LivingEntity m)) {
return false;
}
return plugin.isAuraMob(m);
}

/**
Expand Down

0 comments on commit 5f3a203

Please sign in to comment.