1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-07 00:38:42 +01:00

Deprecated short description in jobs now we should use FullDescription

Now the FullDescription list will be printed to the gui items instead of short description. In fact, some type didn’t make sense, as even simple strings could solve new lines, but many were lazy to do it, with just two characters. So the FullDescription list will be visible on new servers that have just installed jobs or are updating the file manually.

- Added potion effect support to jobs shop to give potion item to player with the given effect type.

Closes #1064
This commit is contained in:
montlikadani 2021-02-03 18:12:20 +01:00
parent c858b53340
commit 7ecb265484
22 changed files with 181 additions and 71 deletions

View File

@ -102,7 +102,12 @@ public class GuiManager {
else else
lore.add(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100))); lore.add(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100)));
lore.addAll(Arrays.asList(job.getDescription().split("/n|\\n"))); if (job.getDescription().isEmpty()) {
for (String desc : job.getFullDescription()) {
lore.add(desc);
}
} else
lore.addAll(Arrays.asList(job.getDescription().split("/n|\\n")));
if (job.getMaxSlots() != null) if (job.getMaxSlots() != null)
lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftSlots") + ((job.getMaxSlots() - Jobs.getUsedSlots(job)) > 0 ? (job.getMaxSlots() - Jobs lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftSlots") + ((job.getMaxSlots() - Jobs.getUsedSlots(job)) > 0 ? (job.getMaxSlots() - Jobs

View File

@ -70,6 +70,11 @@ public class browse implements Cmd {
if (!one.getDescription().isEmpty()) if (!one.getDescription().isEmpty())
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one.getDescription().replaceAll("/n|\n", "")); hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one.getDescription().replaceAll("/n|\n", ""));
else {
for (String desc : one.getFullDescription()) {
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", desc);
}
}
if (one.getMaxLevel(sender) > 0) { if (one.getMaxLevel(sender) > 0) {
if (!hoverMsg.isEmpty()) if (!hoverMsg.isEmpty())
@ -143,6 +148,11 @@ public class browse implements Cmd {
if (!one.getDescription().isEmpty()) if (!one.getDescription().isEmpty())
msg += Jobs.getLanguage().getMessage("command.browse.output.console.description", "[description]", one.getDescription().replaceAll("/n|\n", "")); msg += Jobs.getLanguage().getMessage("command.browse.output.console.description", "[description]", one.getDescription().replaceAll("/n|\n", ""));
else {
for (String desc : one.getFullDescription()) {
msg += Jobs.getLanguage().getMessage("command.browse.output.console.description", "[description]", desc);
}
}
if (one.getMaxLevel(sender) > 0) if (one.getMaxLevel(sender) > 0)
msg += Jobs.getLanguage().getMessage("command.browse.output.console.newMax", "[max]", one.getMaxLevel(sender)); msg += Jobs.getLanguage().getMessage("command.browse.output.console.newMax", "[max]", one.getMaxLevel(sender));
@ -212,6 +222,11 @@ public class browse implements Cmd {
lines.add(builder.toString()); lines.add(builder.toString());
if (!job.getDescription().isEmpty()) if (!job.getDescription().isEmpty())
lines.add(" - " + job.getDescription().replaceAll("/n|\n", "")); lines.add(" - " + job.getDescription().replaceAll("/n|\n", ""));
else {
for (String desc : job.getFullDescription()) {
lines.add(" - " + desc);
}
}
} }
if (lines.isEmpty()) { if (lines.isEmpty()) {

View File

@ -573,9 +573,8 @@ public class GeneralConfigManager {
"jobstotalplayers: The number of people in that particular job", "jobstotalplayers: The number of people in that particular job",
"Exponential equation: totalworkers / totaljobs / jobstotalplayers - 1", "Exponential equation: totalworkers / totaljobs / jobstotalplayers - 1",
"Linear equation: ((totalworkers / totaljobs) - jobstotalplayers)/10.0"); "Linear equation: ((totalworkers / totaljobs) - jobstotalplayers)/10.0");
String maxExpEquationInput = c.get("Economy.DynamicPayment.equation", "totalworkers / totaljobs / jobstotalplayers - 1");
try { try {
DynamicPaymentEquation = new Parser(maxExpEquationInput); DynamicPaymentEquation = new Parser(c.get("Economy.DynamicPayment.equation", "totalworkers / totaljobs / jobstotalplayers - 1"));
DynamicPaymentEquation.setVariable("totalworkers", 100); DynamicPaymentEquation.setVariable("totalworkers", 100);
DynamicPaymentEquation.setVariable("totaljobs", 10); DynamicPaymentEquation.setVariable("totaljobs", 10);
DynamicPaymentEquation.setVariable("jobstotalplayers", 10); DynamicPaymentEquation.setVariable("jobstotalplayers", 10);
@ -627,11 +626,10 @@ public class GeneralConfigManager {
"You can always use simple number to set money limit", "You can always use simple number to set money limit",
"Default equation is: 500+500*(totallevel/100), this will add 1% from 500 for each level player have", "Default equation is: 500+500*(totallevel/100), this will add 1% from 500 for each level player have",
"So player with 2 jobs with level 15 and 22 will have 685 limit"); "So player with 2 jobs with level 15 and 22 will have 685 limit");
String MoneyLimit = c.get("Economy.Limit.Money.MoneyLimit", "500+500*(totallevel/100)");
try { try {
Parser Equation = new Parser(MoneyLimit); Parser equation = new Parser(c.get("Economy.Limit.Money.MoneyLimit", "500+500*(totallevel/100)"));
Equation.setVariable("totallevel", 1); equation.setVariable("totallevel", 1);
limit.setMaxEquation(Equation); limit.setMaxEquation(equation);
} catch (Throwable e) { } catch (Throwable e) {
Jobs.getPluginLogger().warning("MoneyLimit has an invalid value. Disabling money limit!"); Jobs.getPluginLogger().warning("MoneyLimit has an invalid value. Disabling money limit!");
limit.setEnabled(false); limit.setEnabled(false);
@ -660,11 +658,10 @@ public class GeneralConfigManager {
"You can always use simple number to set limit", "You can always use simple number to set limit",
"Default equation is: 500+500*(totallevel/100), this will add 1% from 500 for each level player have", "Default equation is: 500+500*(totallevel/100), this will add 1% from 500 for each level player have",
"So player with 2 jobs with level 15 and 22 will have 685 limit"); "So player with 2 jobs with level 15 and 22 will have 685 limit");
String PointLimit = c.get("Economy.Limit.Point.Limit", "500+500*(totallevel/100)");
try { try {
Parser Equation = new Parser(PointLimit); Parser equation = new Parser(c.get("Economy.Limit.Point.Limit", "500+500*(totallevel/100)"));
Equation.setVariable("totallevel", 1); equation.setVariable("totallevel", 1);
limit.setMaxEquation(Equation); limit.setMaxEquation(equation);
} catch (Throwable e) { } catch (Throwable e) {
Jobs.getPluginLogger().warning("PointLimit has an invalid value. Disabling money limit!"); Jobs.getPluginLogger().warning("PointLimit has an invalid value. Disabling money limit!");
limit.setEnabled(false); limit.setEnabled(false);
@ -693,11 +690,10 @@ public class GeneralConfigManager {
"You can always use simple number to set exp limit", "You can always use simple number to set exp limit",
"Default equation is: 5000+5000*(totallevel/100), this will add 1% from 5000 for each level player have", "Default equation is: 5000+5000*(totallevel/100), this will add 1% from 5000 for each level player have",
"So player with 2 jobs with level 15 and 22 will have 6850 limit"); "So player with 2 jobs with level 15 and 22 will have 6850 limit");
String expLimit = c.get("Economy.Limit.Exp.Limit", "5000+5000*(totallevel/100)");
try { try {
Parser Equation = new Parser(expLimit); Parser equation = new Parser(c.get("Economy.Limit.Exp.Limit", "5000+5000*(totallevel/100)"));
Equation.setVariable("totallevel", 1); equation.setVariable("totallevel", 1);
limit.setMaxEquation(Equation); limit.setMaxEquation(equation);
} catch (Throwable e) { } catch (Throwable e) {
Jobs.getPluginLogger().warning("ExpLimit has an invalid value. Disabling money limit!"); Jobs.getPluginLogger().warning("ExpLimit has an invalid value. Disabling money limit!");
limit.setEnabled(false); limit.setEnabled(false);

View File

@ -54,7 +54,7 @@ public class NameTranslatorManager {
materialName = materialName.replace(" ", ""); materialName = materialName.replace(" ", "");
CMIMaterial mat = CMIMaterial.get(materialName.replace(" ", "")); CMIMaterial mat = CMIMaterial.get(materialName);
NameList nameLs = ListOfNames.get(mat); NameList nameLs = ListOfNames.get(mat);
if (nameLs != null) { if (nameLs != null) {
@ -66,7 +66,7 @@ public class NameTranslatorManager {
} }
if (name != null && !name.isEmpty()) { if (name != null && !name.isEmpty()) {
mat = CMIMaterial.get(materialName.replace(" ", "")); mat = CMIMaterial.get(materialName);
nameLs = ListOfNames.get(mat); nameLs = ListOfNames.get(mat);
if (nameLs != null) { if (nameLs != null) {

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -17,6 +18,9 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMIGUI.CMIGui; import com.gamingmesh.jobs.CMIGUI.CMIGui;
@ -26,6 +30,7 @@ import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIRows;
import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.CMIChatColor;
import com.gamingmesh.jobs.CMILib.CMIEnchantment; import com.gamingmesh.jobs.CMILib.CMIEnchantment;
import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.CMILib.CMIMaterial;
import com.gamingmesh.jobs.CMILib.Version;
import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.BoostMultiplier;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobItems; import com.gamingmesh.jobs.container.JobItems;
@ -35,6 +40,7 @@ import com.gamingmesh.jobs.container.PlayerPoints;
import com.gamingmesh.jobs.container.ShopItem; import com.gamingmesh.jobs.container.ShopItem;
import com.gamingmesh.jobs.stuff.GiveItem; import com.gamingmesh.jobs.stuff.GiveItem;
@SuppressWarnings("deprecation")
public class ShopManager { public class ShopManager {
private final List<ShopItem> list = new ArrayList<>(); private final List<ShopItem> list = new ArrayList<>();
@ -195,7 +201,6 @@ public class ShopManager {
if (item.isHeadOwner()) { if (item.isHeadOwner()) {
Jobs.getNms().setSkullOwner(skullMeta, jPlayer.getPlayer()); Jobs.getNms().setSkullOwner(skullMeta, jPlayer.getPlayer());
} else { } else {
@SuppressWarnings("deprecation")
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead()); OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead());
Jobs.getNms().setSkullOwner(skullMeta, offPlayer); Jobs.getNms().setSkullOwner(skullMeta, offPlayer);
} }
@ -321,9 +326,7 @@ public class ShopManager {
continue; continue;
} }
double price = nameSection.getDouble("Price"); ShopItem sItem = new ShopItem(category, nameSection.getDouble("Price"));
ShopItem sItem = new ShopItem(category, price);
if (nameSection.isString("Icon.Id")) if (nameSection.isString("Icon.Id"))
sItem.setIconMaterial(nameSection.getString("Icon.Id")); sItem.setIconMaterial(nameSection.getString("Icon.Id"));
@ -409,39 +412,49 @@ public class ShopManager {
} }
int amount = itemSection.getInt("Amount", 1); int amount = itemSection.getInt("Amount", 1);
String name = CMIChatColor.translate(itemSection.getString("Name"));
String name = null;
if (itemSection.isString("Name"))
name = CMIChatColor.translate(itemSection.getString("Name"));
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
if (itemSection.contains("Lore")) for (String eachLine : itemSection.getStringList("Lore")) {
for (String eachLine : itemSection.getStringList("Lore")) { lore.add(CMIChatColor.translate(eachLine));
lore.add(CMIChatColor.translate(eachLine)); }
}
HashMap<Enchantment, Integer> enchants = new HashMap<>(); Map<Enchantment, Integer> enchants = new HashMap<>();
if (itemSection.contains("Enchants")) for (String eachLine : itemSection.getStringList("Enchants")) {
for (String eachLine : itemSection.getStringList("Enchants")) { if (!eachLine.contains("="))
if (!eachLine.contains("=")) continue;
String[] split = eachLine.split("=");
Enchantment ench = CMIEnchantment.getEnchantment(split[0]);
Integer level = 1;
if (split.length > 1) {
try {
level = Integer.parseInt(split[1]);
} catch (NumberFormatException e) {
continue; continue;
String[] split = eachLine.split("=");
Enchantment ench = CMIEnchantment.getEnchantment(split[0]);
Integer level = 1;
if (split.length > 1) {
try {
level = Integer.parseInt(split[1]);
} catch (NumberFormatException e) {
continue;
}
} }
if (ench != null)
enchants.put(ench, level);
} }
items.add(new JobItems(node, id == null ? CMIMaterial.STONE : CMIMaterial.get(id), amount, name, lore, enchants, new BoostMultiplier(), new ArrayList<Job>())); if (ench != null)
enchants.put(ench, level);
}
Object potionData = null;
if (itemSection.contains("potion-type")) {
PotionType type = PotionType.valueOf(itemSection.getString("potion-type", "speed").toUpperCase());
if (type == null) {
type = PotionType.SPEED;
}
if (Version.isCurrentEqualOrHigher(Version.v1_10_R1)) {
potionData = new PotionData(type);
} else {
potionData = new Potion(type, 1, false);
}
}
items.add(new JobItems(node, id == null ? CMIMaterial.STONE : CMIMaterial.get(id), amount, name, lore,
enchants, new BoostMultiplier(), new ArrayList<Job>(), potionData));
} }
sItem.setitems(items); sItem.setitems(items);
} }

View File

@ -91,13 +91,23 @@ public class Job {
private int maxDailyQuests = 1; private int maxDailyQuests = 1;
private int id = 0; private int id = 0;
@Deprecated
public Job(String jobName, String fullName, String jobShortName, String description, CMIChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel, public Job(String jobName, String fullName, String jobShortName, String description, CMIChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, HashMap<String, JobItems> jobItems,
HashMap<String, JobLimitedItems> jobLimitedItems, List<String> cmdOnJoin, List<String> cmdOnLeave, ItemStack guiItem, int guiSlot, String bossbar, Long rejoinCD, List<String> worldBlacklist) {
this(jobName, fullName, jobShortName, jobColour, maxExpEquation, displayMethod, maxLevel,
vipmaxLevel, maxSlots, jobPermissions, jobCommands, jobConditions, jobItems,
jobLimitedItems, cmdOnJoin, cmdOnLeave, guiItem, guiSlot, bossbar, rejoinCD, worldBlacklist);
this.description = description;
}
public Job(String jobName, String fullName, String jobShortName, CMIChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, HashMap<String, JobItems> jobItems, int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, HashMap<String, JobItems> jobItems,
HashMap<String, JobLimitedItems> jobLimitedItems, List<String> cmdOnJoin, List<String> cmdOnLeave, ItemStack guiItem, int guiSlot, String bossbar, Long rejoinCD, List<String> worldBlacklist) { HashMap<String, JobLimitedItems> jobLimitedItems, List<String> cmdOnJoin, List<String> cmdOnLeave, ItemStack guiItem, int guiSlot, String bossbar, Long rejoinCD, List<String> worldBlacklist) {
this.jobName = jobName == null ? "" : jobName; this.jobName = jobName == null ? "" : jobName;
this.fullName = fullName == null ? "" : fullName; this.fullName = fullName == null ? "" : fullName;
this.jobShortName = jobShortName; this.jobShortName = jobShortName;
this.description = description;
this.jobColour = jobColour; this.jobColour = jobColour;
this.maxExpEquation = maxExpEquation; this.maxExpEquation = maxExpEquation;
this.displayMethod = displayMethod; this.displayMethod = displayMethod;
@ -291,6 +301,7 @@ public class Job {
/** /**
* Get the shortened version of the jobName * Get the shortened version of the jobName
*
* @return the shortened version of the jobName * @return the shortened version of the jobName
*/ */
public String getShortName() { public String getShortName() {
@ -299,8 +310,11 @@ public class Job {
/** /**
* Gets the description * Gets the description
*
* @return description * @return description
* @deprecated Not used anymore, use {@link #getFullDescription()} instead
*/ */
@Deprecated
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -483,7 +497,10 @@ public class Job {
public void setFullDescription(List<String> fDescription) { public void setFullDescription(List<String> fDescription) {
this.fDescription.clear(); this.fDescription.clear();
this.fDescription.addAll(fDescription == null ? new ArrayList<>() : fDescription);
if (fDescription != null) {
this.fDescription.addAll(fDescription);
}
} }
public List<Quest> getQuests() { public List<Quest> getQuests() {

View File

@ -21,6 +21,7 @@ package com.gamingmesh.jobs.container;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -28,31 +29,45 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffectType;
import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.CMIChatColor;
import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.CMILib.CMIMaterial;
import com.gamingmesh.jobs.CMILib.CMIReflections; import com.gamingmesh.jobs.CMILib.CMIReflections;
import com.gamingmesh.jobs.CMILib.Version;
@SuppressWarnings("deprecation")
public class JobItems { public class JobItems {
private String node; private String node;
private String legacyKey; private String legacyKey;
private ItemStack item; private ItemStack item;
private HashMap<Enchantment, Integer> enchants; private Object potion;
private final Map<Enchantment, Integer> enchants = new HashMap<>();
private BoostMultiplier boostMultiplier = new BoostMultiplier(); private BoostMultiplier boostMultiplier = new BoostMultiplier();
private List<Job> jobs = new ArrayList<>(); private final List<Job> jobs = new ArrayList<>();
private int fromLevel = 0; private int fromLevel = 0;
private int untilLevel = Integer.MAX_VALUE; private int untilLevel = Integer.MAX_VALUE;
public JobItems(String node, CMIMaterial mat, int amount, String name, List<String> lore, HashMap<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier, List<Job> jobs) { public JobItems(String node, CMIMaterial mat, int amount, String name, List<String> lore, HashMap<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier, List<Job> jobs) {
this(node, mat, amount, name, lore, enchants, boostMultiplier, jobs, null);
}
public JobItems(String node, CMIMaterial mat, int amount, String name, List<String> lore, Map<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier, List<Job> jobs,
Object potion) {
if (mat == null) { if (mat == null) {
mat = CMIMaterial.STONE; mat = CMIMaterial.STONE;
} }
this.enchants = enchants; if (enchants != null) {
this.enchants.putAll(enchants);
}
this.node = node; this.node = node;
if (boostMultiplier != null) { if (boostMultiplier != null) {
@ -62,6 +77,21 @@ public class JobItems {
setJobs(jobs); setJobs(jobs);
ItemMeta meta = (item = mat.newItemStack()).getItemMeta(); ItemMeta meta = (item = mat.newItemStack()).getItemMeta();
if (CMIMaterial.isPotion(mat.getMaterial()) && potion != null && meta instanceof PotionMeta) {
PotionMeta potionMeta = (PotionMeta) meta;
if (Version.isCurrentEqualOrHigher(Version.v1_10_R1) && potion instanceof org.bukkit.potion.PotionData) {
potionMeta.setBasePotionData((org.bukkit.potion.PotionData) potion);
} else if (potion instanceof org.bukkit.potion.Potion) {
PotionEffectType effectType = ((org.bukkit.potion.Potion) potion).getType().getEffectType();
if (effectType != null) {
potionMeta.setMainEffect(effectType);
}
}
meta = potionMeta;
}
if (meta != null) { if (meta != null) {
if (name != null) if (name != null)
meta.setDisplayName(CMIChatColor.translate(name)); meta.setDisplayName(CMIChatColor.translate(name));
@ -103,6 +133,21 @@ public class JobItems {
return item; return item;
} }
if (CMIMaterial.isPotion(item.getType()) && potion != null && meta instanceof PotionMeta) {
PotionMeta potionMeta = (PotionMeta) meta;
if (Version.isCurrentEqualOrHigher(Version.v1_10_R1) && potion instanceof org.bukkit.potion.PotionData) {
potionMeta.setBasePotionData((org.bukkit.potion.PotionData) potion);
} else if (potion instanceof org.bukkit.potion.Potion) {
PotionEffectType effectType = ((org.bukkit.potion.Potion) potion).getType().getEffectType();
if (effectType != null) {
potionMeta.setMainEffect(effectType);
}
}
meta = potionMeta;
}
if (meta.hasDisplayName()) if (meta.hasDisplayName())
meta.setDisplayName(CMIChatColor.translate(meta.getDisplayName().replace("[player]", player.getName()))); meta.setDisplayName(CMIChatColor.translate(meta.getDisplayName().replace("[player]", player.getName())));
@ -148,10 +193,11 @@ public class JobItems {
} }
public void setJobs(List<Job> jobs) { public void setJobs(List<Job> jobs) {
this.jobs = jobs == null ? new ArrayList<>() : jobs; this.jobs.clear();
this.jobs.addAll(jobs);
} }
public HashMap<Enchantment, Integer> getEnchants() { public Map<Enchantment, Integer> getEnchants() {
return enchants; return enchants;
} }

View File

@ -728,9 +728,8 @@ public class JobsPlayer {
*/ */
public void reloadHonorific() { public void reloadHonorific() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
int numJobs = progression.size();
if (numJobs > 0) { if (progression.size() > 0) {
for (JobProgression prog : progression) { for (JobProgression prog : progression) {
DisplayMethod method = prog.getJob().getDisplayMethod(); DisplayMethod method = prog.getJob().getDisplayMethod();
if (method == DisplayMethod.NONE) if (method == DisplayMethod.NONE)
@ -744,8 +743,7 @@ public class JobsPlayer {
} else { } else {
Job nonejob = Jobs.getNoneJob(); Job nonejob = Jobs.getNoneJob();
if (nonejob != null) { if (nonejob != null) {
DisplayMethod method = nonejob.getDisplayMethod(); processesChat(nonejob.getDisplayMethod(), builder, -1, null, nonejob);
processesChat(method, builder, -1, null, nonejob);
} }
} }

View File

@ -18,10 +18,13 @@ exampleJob:
shortname: W shortname: W
# The short description of job # The short description of job
description: Earns money felling and planting trees # Please try to not use this, use FullDescription below
#description: Earns money felling and planting trees
# Full description of job to be shown in job browse command # Full description of job to be shown in job browse command
FullDescription: FullDescription:
- "&7Earns money felling and planting trees"
- ""
- "&2Get money for:" - "&2Get money for:"
- " &7Planting trees" - " &7Planting trees"
- " &7Cutting down trees" - " &7Cutting down trees"

View File

@ -1,7 +1,8 @@
Brewer: Brewer:
fullname: Brewer fullname: Brewer
shortname: Br shortname: Br
description: Earns money brewing potions. FullDescription:
- "Earns money brewing potions."
ChatColour: LIGHT_PURPLE ChatColour: LIGHT_PURPLE
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Builder: Builder:
fullname: Builder fullname: Builder
shortname: B shortname: B
description: Earns money for building structures. FullDescription:
- "Earns money for building structures."
ChatColour: WHITE ChatColour: WHITE
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Crafter: Crafter:
fullname: Crafter fullname: Crafter
shortname: Cr shortname: Cr
description: Earns money from crafting items. FullDescription:
- "Earns money from crafting items."
ChatColour: RED ChatColour: RED
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Digger: Digger:
fullname: Digger fullname: Digger
shortname: D shortname: D
description: Earns money for terraforming the world. FullDescription:
- "Earns money for terraforming the world."
ChatColour: GOLD ChatColour: GOLD
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Enchanter: Enchanter:
fullname: Enchanter fullname: Enchanter
shortname: E shortname: E
description: Earns money enchanting weapons. FullDescription:
- "Earns money enchanting weapons."
ChatColour: DARK_BLUE ChatColour: DARK_BLUE
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Explorer: Explorer:
fullname: Explorer fullname: Explorer
shortname: Ex shortname: Ex
description: Earns money from exploring map. FullDescription:
- "Earns money from exploring map."
ChatColour: AQUA ChatColour: AQUA
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Farmer: Farmer:
fullname: Farmer fullname: Farmer
shortname: Fa shortname: Fa
description: Earns money farming crops. FullDescription:
- "Earns money farming crops."
ChatColour: BLUE ChatColour: BLUE
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Fisherman: Fisherman:
fullname: Fisherman fullname: Fisherman
shortname: Fi shortname: Fi
description: Earns money from fishing. FullDescription:
- "Earns money from fishing."
ChatColour: AQUA ChatColour: AQUA
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Hunter: Hunter:
fullname: Hunter fullname: Hunter
shortname: H shortname: H
description: Earns money killing animals and monsters. FullDescription:
- "Earns money killing animals and monsters."
ChatColour: RED ChatColour: RED
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Miner: Miner:
fullname: Miner fullname: Miner
shortname: M shortname: M
description: Earns money mining minerals and ores. FullDescription:
- "Earns money mining minerals and ores."
ChatColour: DARK_GRAY ChatColour: DARK_GRAY
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Weaponsmith: Weaponsmith:
fullname: Weaponsmith fullname: Weaponsmith
shortname: W shortname: W
description: Earns money from crafting and repairing weapons. FullDescription:
- "Earns money from crafting and repairing weapons."
ChatColour: DARK_PURPLE ChatColour: DARK_PURPLE
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -1,7 +1,8 @@
Woodcutter: Woodcutter:
fullname: Woodcutter fullname: Woodcutter
shortname: W shortname: W
description: Earns money felling and planting trees FullDescription:
- "Earns money felling and planting trees"
ChatColour: GREEN ChatColour: GREEN
chat-display: full chat-display: full
max-level: 200 max-level: 200

View File

@ -55,6 +55,11 @@ Items:
Enchants: Enchants:
- DIG_SPEED=5 - DIG_SPEED=5
- DURABILITY=3 - DURABILITY=3
Giving-Potion:
Id: potion
Amount: 1
Name: "&6Jump boost"
potion-type: jump
# Can be any word # Can be any word
Apple: Apple:
# (Required) Item name # (Required) Item name