mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Update all signs on player doing something in a job
This commit is contained in:
parent
9fa5dfb2aa
commit
f6bd87fe4c
@ -44,7 +44,6 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import com.gamingmesh.jobs.CMILib.ItemReflection;
|
||||
import com.gamingmesh.jobs.CMILib.Reflections;
|
||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||
import com.gamingmesh.jobs.Signs.SignTopType;
|
||||
import com.gamingmesh.jobs.api.JobsJoinEvent;
|
||||
import com.gamingmesh.jobs.api.JobsLeaveEvent;
|
||||
import com.gamingmesh.jobs.api.JobsLevelUpEvent;
|
||||
@ -392,9 +391,10 @@ public class PlayerManager {
|
||||
Jobs.getJobsDAO().joinJob(jPlayer, jPlayer.getJobProgression(job));
|
||||
|
||||
PerformCommands.PerformCommandsOnJoin(jPlayer, job);
|
||||
|
||||
Jobs.takeSlot(job);
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
|
||||
job.updateTotalPlayers();
|
||||
}
|
||||
|
||||
@ -423,8 +423,7 @@ public class PlayerManager {
|
||||
PerformCommands.PerformCommandsOnLeave(jPlayer, job);
|
||||
Jobs.leaveSlot(job);
|
||||
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
job.updateTotalPlayers();
|
||||
return true;
|
||||
}
|
||||
@ -471,8 +470,7 @@ public class PlayerManager {
|
||||
jPlayer.promoteJob(job, levels);
|
||||
jPlayer.save();
|
||||
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -484,8 +482,8 @@ public class PlayerManager {
|
||||
public void demoteJob(JobsPlayer jPlayer, Job job, int levels) {
|
||||
jPlayer.demoteJob(job, levels);
|
||||
jPlayer.save();
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -501,8 +499,7 @@ public class PlayerManager {
|
||||
int oldLevel = prog.getLevel();
|
||||
if (prog.addExperience(experience)) {
|
||||
performLevelUp(jPlayer, job, oldLevel);
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
}
|
||||
|
||||
jPlayer.save();
|
||||
@ -521,8 +518,7 @@ public class PlayerManager {
|
||||
prog.addExperience(-experience);
|
||||
|
||||
jPlayer.save();
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -564,8 +560,7 @@ public class PlayerManager {
|
||||
jPlayer.reloadHonorific();
|
||||
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
||||
performCommandOnLevelUp(jPlayer, prog.getJob(), oldLevel);
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -761,8 +756,7 @@ public class PlayerManager {
|
||||
jPlayer.reloadHonorific();
|
||||
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
||||
performCommandOnLevelUp(jPlayer, prog.getJob(), oldLevel);
|
||||
Jobs.getSignUtil().SignUpdate(job);
|
||||
Jobs.getSignUtil().SignUpdate(job, SignTopType.gtoplist);
|
||||
Jobs.getSignUtil().updateAllSign(job);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,6 +162,12 @@ public class SignUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAllSign(Job job) {
|
||||
for (SignTopType types : SignTopType.values()) {
|
||||
SignUpdate(job, types);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean SignUpdate(Job job) {
|
||||
return SignUpdate(job, SignTopType.toplist);
|
||||
}
|
||||
|
@ -49,16 +49,12 @@ public class join implements Cmd {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
|
||||
if (jPlayer.isInJob(job)) {
|
||||
// already in job message
|
||||
String message = Jobs.getLanguage().getMessage("command.join.error.alreadyin");
|
||||
message = message.replace("%jobname%", job.getChatColor() + job.getName());
|
||||
pSender.sendMessage(message);
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
||||
String message = Jobs.getLanguage().getMessage("command.join.error.fullslots");
|
||||
message = message.replace("%jobname%", job.getChatColor() + job.getName());
|
||||
pSender.sendMessage(message);
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.fullslots", "%jobname%", job.getChatColor() + job.getName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -71,7 +67,8 @@ public class join implements Cmd {
|
||||
|
||||
if (args.length == 2 && args[1].equalsIgnoreCase("-needConfirmation")) {
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.add(Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()), Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()), "jobs join " + job.getName());
|
||||
rm.add(Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()),
|
||||
Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()), "jobs join " + job.getName());
|
||||
rm.show(pSender);
|
||||
return true;
|
||||
}
|
||||
@ -85,10 +82,7 @@ public class join implements Cmd {
|
||||
}
|
||||
|
||||
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
||||
|
||||
String message = Jobs.getLanguage().getMessage("command.join.success");
|
||||
message = message.replace("%jobname%", job.getChatColor() + job.getName());
|
||||
pSender.sendMessage(message);
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.success", "%jobname%", job.getChatColor() + job.getName()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user