1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

Have some idiot who gives 99999... (lots of 9 numbers)

This commit is contained in:
montlikadani 2020-08-31 20:08:56 +02:00
parent 40ace4f946
commit e52e954843
2 changed files with 6 additions and 4 deletions

View File

@ -495,8 +495,9 @@ public class PlayerManager {
*/
public void addExperience(JobsPlayer jPlayer, Job job, double experience) {
JobProgression prog = jPlayer.getJobProgression(job);
if (prog == null)
if (prog == null || experience > Double.MAX_VALUE)
return;
int oldLevel = prog.getLevel();
if (prog.addExperience(experience)) {
performLevelUp(jPlayer, job, oldLevel);
@ -514,8 +515,9 @@ public class PlayerManager {
*/
public void removeExperience(JobsPlayer jPlayer, Job job, double experience) {
JobProgression prog = jPlayer.getJobProgression(job);
if (prog == null)
if (prog == null || experience > Double.MAX_VALUE)
return;
prog.addExperience(-experience);
jPlayer.save();

View File

@ -32,14 +32,14 @@ public class removexp implements Cmd {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
double xpLost;
double xpLost = 0D;
try {
xpLost = Double.parseDouble(args[2]);
} catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true;
}
if (xpLost <= 0) {
if (xpLost <= 0 || xpLost > Double.MAX_VALUE) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true;
}