1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 12:35:28 +01:00

Lets perform correct level actions when adding exp

This commit is contained in:
Zrips 2020-04-25 15:51:18 +03:00
parent d47c059ef1
commit d967985325
2 changed files with 19 additions and 16 deletions

View File

@ -39,17 +39,17 @@ public class exp implements Cmd {
Action action = Action.Add;
switch (args[2].toLowerCase()) {
case "add":
action = Action.Add;
break;
case "set":
action = Action.Set;
break;
case "take":
action = Action.Take;
break;
default:
break;
case "add":
action = Action.Add;
break;
case "set":
action = Action.Set;
break;
case "take":
action = Action.Take;
break;
default:
break;
}
double amount = 0.0;
@ -67,7 +67,9 @@ public class exp implements Cmd {
switch (action) {
case Add:
prog.addExperience(amount);
int oldLevel = prog.getLevel();
if (prog.addExperience(amount))
Jobs.getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel);
break;
case Set:
prog.setExperience(amount);
@ -81,11 +83,11 @@ public class exp implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getChatColor() + job.getName(), "%level%", prog.getLevel(), "%exp%", prog.getExperience()));
player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getChatColor() + job.getName(), "%level%", prog.getLevel(), "%exp%", prog
.getExperience()));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} else
sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob"));
} catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
}

View File

@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
import org.bukkit.event.server.ServerCommandEvent;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Debug;
public class QuestProgression {