1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 22:13:25 +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

@ -67,7 +67,9 @@ public class exp implements Cmd {
switch (action) { switch (action) {
case Add: case Add:
prog.addExperience(amount); int oldLevel = prog.getLevel();
if (prog.addExperience(amount))
Jobs.getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel);
break; break;
case Set: case Set:
prog.setExperience(amount); prog.setExperience(amount);
@ -81,8 +83,8 @@ public class exp implements Cmd {
Player player = jPlayer.getPlayer(); Player player = jPlayer.getPlayer();
if (player != null) 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")); sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} else } else
sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob")); sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob"));

View File

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