mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Adding and taking exp should calculating correctly
This commit is contained in:
parent
9ab41f73ee
commit
92e9e9d15b
@ -64,19 +64,16 @@ public class exp implements Cmd {
|
|||||||
// check if player already has the job
|
// check if player already has the job
|
||||||
if (jPlayer.isInJob(job)) {
|
if (jPlayer.isInJob(job)) {
|
||||||
JobProgression prog = jPlayer.getJobProgression(job);
|
JobProgression prog = jPlayer.getJobProgression(job);
|
||||||
double total = 0d;
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Add:
|
case Add:
|
||||||
total = (prog.getExperience() + amount);
|
prog.addExperience(amount);
|
||||||
prog.addExperience(total);
|
|
||||||
break;
|
break;
|
||||||
case Set:
|
case Set:
|
||||||
prog.setExperience(amount);
|
prog.setExperience(amount);
|
||||||
break;
|
break;
|
||||||
case Take:
|
case Take:
|
||||||
total = (prog.getExperience() - amount);
|
prog.takeExperience(amount);
|
||||||
prog.takeExperience(total);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -291,9 +291,9 @@ public class ConfigManager {
|
|||||||
} else if (actionType == ActionType.KILL || actionType == ActionType.TAME || actionType == ActionType.BREED || actionType == ActionType.MILK) {
|
} else if (actionType == ActionType.KILL || actionType == ActionType.TAME || actionType == ActionType.BREED || actionType == ActionType.MILK) {
|
||||||
|
|
||||||
// check entities
|
// check entities
|
||||||
EntityType entity = EntityType.fromName(myKey.toUpperCase());
|
EntityType entity = EntityType.fromName(myKey);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = EntityType.valueOf(myKey.toUpperCase());
|
entity = EntityType.valueOf(myKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null && entity.isAlive()) {
|
if (entity != null && entity.isAlive()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user