mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Fix when opening browse from jobs info
This commit is contained in:
parent
ec9507e836
commit
eb978e6db8
@ -126,7 +126,7 @@ public class GuiManager {
|
||||
|
||||
ItemStack GuiItem = job.getGuiItem();
|
||||
ItemMeta meta = GuiItem.getItemMeta();
|
||||
meta.setDisplayName(job.getChatColor() + job.getName());
|
||||
meta.setDisplayName(job.getNameWithColor());
|
||||
meta.setLore(Lore);
|
||||
GuiItem.setItemMeta(meta);
|
||||
|
||||
@ -222,12 +222,12 @@ public class GuiManager {
|
||||
|
||||
double xp = jInfo.getExperience(level, numjobs);
|
||||
xp = boost.getFinalAmount(CurrencyType.EXP, xp) + ((Jobs.getPlayerManager().getInventoryBoost(player, job)
|
||||
.get(CurrencyType.EXP)) + 1);
|
||||
.get(CurrencyType.EXP)) + 1);
|
||||
String xpColor = xp >= 0 ? "" : ChatColor.GRAY.toString();
|
||||
|
||||
double points = jInfo.getPoints(level, numjobs);
|
||||
points = boost.getFinalAmount(CurrencyType.POINTS, points) + ((Jobs.getPlayerManager().getInventoryBoost(player, job)
|
||||
.get(CurrencyType.POINTS)) + 1);
|
||||
.get(CurrencyType.POINTS)) + 1);
|
||||
String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString();
|
||||
|
||||
if (income == 0D && points == 0D && xp == 0D)
|
||||
@ -237,16 +237,16 @@ public class GuiManager {
|
||||
String val = "";
|
||||
|
||||
if (income != 0.0)
|
||||
val += Jobs.getLanguage().getMessage("command.info.help.money", "%money%", incomeColor +
|
||||
String.format(Jobs.getGCManager().getDecimalPlacesMoney(), income));
|
||||
val += Jobs.getLanguage().getMessage("command.info.help.money", "%money%", incomeColor
|
||||
+ String.format(Jobs.getGCManager().getDecimalPlacesMoney(), income));
|
||||
|
||||
if (points != 0.0)
|
||||
val += Jobs.getLanguage().getMessage("command.info.help.points", "%points%", pointsColor
|
||||
+ String.format(Jobs.getGCManager().getDecimalPlacesPoints(), points));
|
||||
+ String.format(Jobs.getGCManager().getDecimalPlacesPoints(), points));
|
||||
|
||||
if (xp != 0.0)
|
||||
val += Jobs.getLanguage().getMessage("command.info.help.exp", "%exp%", xpColor
|
||||
+ String.format(Jobs.getGCManager().getDecimalPlacesExp(), xp));
|
||||
+ String.format(Jobs.getGCManager().getDecimalPlacesExp(), xp));
|
||||
|
||||
Lore.add(Jobs.getLanguage().getMessage("command.info.help.material", "%material%", itemName) + val);
|
||||
|
||||
@ -261,7 +261,7 @@ public class GuiManager {
|
||||
}
|
||||
|
||||
ItemMeta meta = GuiItem.getItemMeta();
|
||||
meta.setDisplayName(job.getChatColor() + job.getName());
|
||||
meta.setDisplayName(job.getNameWithColor());
|
||||
meta.setLore(Lore);
|
||||
GuiItem.setItemMeta(meta);
|
||||
tempInv.setItem(i, GuiItem.clone());
|
||||
@ -281,7 +281,7 @@ public class GuiManager {
|
||||
}
|
||||
|
||||
ItemMeta meta = GuiItem.getItemMeta();
|
||||
meta.setDisplayName(job.getChatColor() + job.getName());
|
||||
meta.setDisplayName(job.getNameWithColor());
|
||||
meta.setLore(Lore);
|
||||
GuiItem.setItemMeta(meta);
|
||||
tempInv.setItem(i, GuiItem.clone());
|
||||
@ -307,24 +307,21 @@ public class GuiManager {
|
||||
gui.addButton(new CMIGuiButton(i1, items.get(i1)));
|
||||
}
|
||||
|
||||
if (fromCommand) {
|
||||
return;
|
||||
if (!fromCommand) {
|
||||
ItemStack skull = Jobs.getGCManager().guiBackButton;
|
||||
ItemMeta skullMeta = skull.getItemMeta();
|
||||
|
||||
skullMeta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back"));
|
||||
skull.setItemMeta(skullMeta);
|
||||
|
||||
gui.addButton(new CMIGuiButton(backButton, skull) {
|
||||
@Override
|
||||
public void click(GUIClickType type) {
|
||||
openJobsBrowseGUI(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ItemStack skull = Jobs.getGCManager().guiBackButton;
|
||||
|
||||
ItemMeta skullMeta = skull.getItemMeta();
|
||||
skullMeta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back"));
|
||||
|
||||
skull.setItemMeta(skullMeta);
|
||||
|
||||
gui.addButton(new CMIGuiButton(backButton, skull) {
|
||||
@Override
|
||||
public void click(GUIClickType type) {
|
||||
openJobsBrowseGUI(player);
|
||||
}
|
||||
});
|
||||
|
||||
gui.fillEmptyButtons();
|
||||
gui.open();
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
message.add(m);
|
||||
} else if (showAllTypes == 0) {
|
||||
String myMessage = Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() + ".none");
|
||||
myMessage = myMessage.replace("%jobname%", job.getChatColor() + job.getName());
|
||||
myMessage = myMessage.replace("%jobname%", job.getNameWithColor());
|
||||
message.add(myMessage);
|
||||
}
|
||||
}
|
||||
@ -418,7 +418,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
Title title = Jobs.gettitleManager().getTitle(jobProg.getLevel(), jobProg.getJob().getName());
|
||||
String message = Jobs.getLanguage().getMessage("command.stats.output",
|
||||
"%joblevel%", jobProg.getLevel(),
|
||||
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
|
||||
"%jobname%", jobProg.getJob().getNameWithColor(),
|
||||
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
|
||||
"%jobmaxxp%", jobProg.getMaxExperience(),
|
||||
"%titlename%", title == null ? "Unknown" : title.getName());
|
||||
@ -457,7 +457,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
double exp = jPlayer.getExpAfterRejoin(jobProg, jPlayer.getLevelAfterRejoin(jobProg));
|
||||
String message = Jobs.getLanguage().getMessage("command.stats.output",
|
||||
"%joblevel%", level,
|
||||
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
|
||||
"%jobname%", jobProg.getJob().getNameWithColor(),
|
||||
"%jobxp%", Math.round(exp * 100.0) / 100.0,
|
||||
"%jobmaxxp%", jobProg.getMaxExperience(level));
|
||||
return " " + jobProgressMessage(jobProg.getMaxExperience(level), exp) + " " + message;
|
||||
|
@ -42,7 +42,7 @@ public class demote implements Cmd {
|
||||
Player player = Bukkit.getServer().getPlayer(jPlayer.getUniqueId());
|
||||
if (player != null) {
|
||||
String message = Jobs.getLanguage().getMessage("command.demote.output.target",
|
||||
"%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE,
|
||||
"%jobname%", job.getNameWithColor() + ChatColor.WHITE,
|
||||
"%levelslost%", levelsLost);
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class editjobs implements Cmd {
|
||||
showPath(player, null, null, null);
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", one.getChatColor() + one.getName()), one.getName(), "jobs editjobs list " + one.getName());
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", one.getNameWithColor()), one.getName(), "jobs editjobs list " + one.getName());
|
||||
rm.show(sender);
|
||||
}
|
||||
Util.getJobsEditorMap().remove(player.getUniqueId());
|
||||
|
@ -49,8 +49,8 @@ public class editquests implements Cmd {
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editquests.help.list.jobs", "%jobname%", one.getChatColor()
|
||||
+ one.getName()), one.getName(), "jobs editquests list " + one.getName());
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editquests.help.list.jobs", "%jobname%", one.getNameWithColor()),
|
||||
one.getName(), "jobs editquests list " + one.getName());
|
||||
rm.show(sender);
|
||||
}
|
||||
|
||||
@ -595,8 +595,8 @@ public class editquests implements Cmd {
|
||||
|
||||
if (job != null) {
|
||||
rm = new RawMessage();
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editquests.help.list.jobs", "%jobname%", job.getChatColor()
|
||||
+ job.getName()), job.getName(), "jobs editquests list " + job.getName());
|
||||
rm.add(Jobs.getLanguage().getMessage("command.editquests.help.list.jobs", "%jobname%", job.getNameWithColor()),
|
||||
job.getName(), "jobs editquests list " + job.getName());
|
||||
rm.show(player);
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,13 @@ public class employ implements Cmd {
|
||||
|
||||
if (jPlayer.isInJob(job)) {
|
||||
// already in job message
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getNameWithColor()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
||||
String message = Jobs.getLanguage().getMessage("command.employ.error.fullslots");
|
||||
message = message.replace("%jobname%", job.getChatColor() + job.getName());
|
||||
message = message.replace("%jobname%", job.getNameWithColor());
|
||||
sender.sendMessage(message);
|
||||
return true;
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class employ implements Cmd {
|
||||
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.employ.output.target", "%jobname%", job.getChatColor() + job.getName()));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.employ.output.target", "%jobname%", job.getNameWithColor()));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
} catch (Throwable e) {
|
||||
|
@ -83,7 +83,7 @@ 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
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.exp.output.target", "%jobname%", job.getNameWithColor(), "%level%", prog.getLevel(), "%exp%", prog
|
||||
.getExperience()));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
} else
|
||||
|
@ -33,14 +33,14 @@ public class fire implements Cmd {
|
||||
}
|
||||
|
||||
if (!jPlayer.isInJob(job)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.fire.error.nojob", "%jobname%", job.getChatColor() + job.getName()));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.fire.error.nojob", "%jobname%", job.getNameWithColor()));
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
Jobs.getPlayerManager().leaveJob(jPlayer, job);
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.fire.output.target", "%jobname%", job.getChatColor() + job.getName()));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.fire.output.target", "%jobname%", job.getNameWithColor()));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
} catch (Throwable e) {
|
||||
|
@ -50,7 +50,7 @@ public class grantxp implements Cmd {
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null) {
|
||||
String message = Jobs.getLanguage().getMessage("command.grantxp.output.target",
|
||||
"%jobname%", job.getChatColor() + job.getName(),
|
||||
"%jobname%", job.getNameWithColor(),
|
||||
"%xpgained%", xpGained);
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
@ -49,12 +49,12 @@ public class join implements Cmd {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
|
||||
if (jPlayer.isInJob(job)) {
|
||||
// already in job message
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()));
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.alreadyin", "%jobname%", job.getNameWithColor()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.fullslots", "%jobname%", job.getChatColor() + job.getName()));
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.fullslots", "%jobname%", job.getNameWithColor()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class join implements Cmd {
|
||||
}
|
||||
|
||||
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.success", "%jobname%", job.getChatColor() + job.getName()));
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.success", "%jobname%", job.getNameWithColor()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class leave implements Cmd {
|
||||
20 * Jobs.getGCManager().ConfirmExpiryTime);
|
||||
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leave.confirmationNeed", "[jobname]",
|
||||
job.getChatColor() + job.getName(), "[time]", Jobs.getGCManager().ConfirmExpiryTime));
|
||||
job.getNameWithColor(), "[time]", Jobs.getGCManager().ConfirmExpiryTime));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class leave implements Cmd {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
|
||||
|
||||
if (Jobs.getPlayerManager().leaveJob(jPlayer, job))
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leave.success", "%jobname%", job.getChatColor() + job.getName()));
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("command.leave.success", "%jobname%", job.getNameWithColor()));
|
||||
else
|
||||
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class level implements Cmd {
|
||||
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.level.output.target", "%jobname%", job.getChatColor() + job.getName(), "%level%", prog.getLevel(), "%exp%", prog.getExperience()));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.level.output.target", "%jobname%", job.getNameWithColor(), "%level%", prog.getLevel(), "%exp%", prog.getExperience()));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
} else
|
||||
|
@ -39,7 +39,7 @@ public class promote implements Cmd {
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null)
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.promote.output.target",
|
||||
"%jobname%", job.getChatColor() + job.getName(),
|
||||
"%jobname%", job.getNameWithColor(),
|
||||
"%levelsgained%", levelsGained));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
|
@ -50,7 +50,7 @@ public class removexp implements Cmd {
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.removexp.output.target",
|
||||
"%jobname%", job.getChatColor() + job.getName(),
|
||||
"%jobname%", job.getNameWithColor(),
|
||||
"%xplost%", xpLost));
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@ public class transfer implements Cmd {
|
||||
Player player = jPlayer.getPlayer();
|
||||
if (player != null) {
|
||||
String message = Jobs.getLanguage().getMessage("command.transfer.output.target",
|
||||
"%oldjobname%", oldjob.getChatColor() + oldjob.getName(),
|
||||
"%newjobname%", newjob.getChatColor() + newjob.getName());
|
||||
"%oldjobname%", oldjob.getNameWithColor(),
|
||||
"%newjobname%", newjob.getNameWithColor());
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class BossBarManager {
|
||||
|
||||
String message = Jobs.getLanguage().getMessage("command.stats.bossBarOutput",
|
||||
"%joblevel%", Integer.valueOf(jobProg.getLevel()).toString(),
|
||||
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
|
||||
"%jobname%", jobProg.getJob().getNameWithColor(),
|
||||
"%jobxp%", formatter.format(Math.round(jobProg.getExperience() * 100.0) / 100.0),
|
||||
"%jobmaxxp%", jobProg.getMaxExperience(),
|
||||
"%gain%", gain);
|
||||
|
@ -258,6 +258,10 @@ public class Job {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
public String getNameWithColor() {
|
||||
return jobColour + fullName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the job name from the config
|
||||
* @return the job name from the config
|
||||
|
@ -685,7 +685,7 @@ public class JobsPlayer {
|
||||
if (gotTitle) {
|
||||
builder.append(" ");
|
||||
}
|
||||
String honorificpart = prog.getJob().getChatColor() + prog.getJob().getName() + ChatColor.WHITE;
|
||||
String honorificpart = prog.getJob().getNameWithColor() + ChatColor.WHITE;
|
||||
if (honorificpart.contains("{level}"))
|
||||
honorificpart = honorificpart.replace("{level}", String.valueOf(prog.getLevel()));
|
||||
builder.append(honorificpart);
|
||||
|
Loading…
Reference in New Issue
Block a user