Make sure ExperienceData getExpForLevel returns a value.

This commit is contained in:
MobiusDevelopment
2022-04-01 23:17:33 +00:00
parent ded25bb320
commit a99111eff5
4 changed files with 56 additions and 4 deletions

View File

@@ -97,7 +97,20 @@ public class ExperienceData
public long getExpForLevel(int level)
{
return _expTable.get(level);
if (level <= 0)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return 0;
}
final Long exp = _expTable.get(level);
if (exp == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Requested exp for level " + level);
return _expTable.get((int) MAX_LEVEL);
}
return exp.longValue();
}
public byte getMaxLevel()