1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Jobs shop items now use enchants

- Fix level no job error message path not found
This commit is contained in:
montlikadani 2019-04-25 20:47:10 +02:00
parent f9ebb0bec3
commit 472112377f
5 changed files with 19 additions and 10 deletions

View File

@ -69,9 +69,6 @@ public class SignUtil {
// Signs save file
public void saveSigns() {
if (!Jobs.getGCManager().SignsEnabled)
return;
File f = new File(Jobs.getFolder(), "Signs.yml");
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);

View File

@ -590,7 +590,7 @@ public class LanguageManager {
c.get("command.level.help.info", "Change the player's level in a job.");
c.get("command.level.help.args", "[playername] [jobname] set/add/take [amount]");
Jobs.getGCManager().commandArgs.put("level", Arrays.asList("[playername]", "[jobname]", "set%%add%%take"));
c.get("command.exp.error.nojob", "&cThis player must first join a job.");
c.get("command.level.error.nojob", "&cThis player must first join a job.");
c.get("command.level.output.target", "&eYour level was changed for %jobname% &eand now you at &6%level%lvl &eand with &6%exp%exp.");
c.get("command.demote.help.info", "Demote the player X levels in a job.");

View File

@ -37,6 +37,7 @@ public class JobItems {
private String node;
private String legacyKey = null;
private ItemStack item;
private HashMap<Enchantment, Integer> enchants;
private BoostMultiplier boostMultiplier = new BoostMultiplier();
private List<Job> jobs = new ArrayList<>();
private int fromLevel = 0;
@ -47,6 +48,7 @@ public class JobItems {
try {
item = mat.newItemStack();
item.setAmount(amount);
this.enchants = enchants;
ItemMeta meta = item.getItemMeta();
if (meta == null)
return;
@ -98,6 +100,11 @@ public class JobItems {
}
meta.setLore(TranslatedLore);
}
if (enchants != null) {
for (Entry<Enchantment, Integer> OneEnchant : enchants.entrySet()) {
meta.addEnchant(OneEnchant.getKey(), OneEnchant.getValue(), true);
}
}
item.setItemMeta(meta);
return item;
} catch (Throwable e) {
@ -125,6 +132,10 @@ public class JobItems {
this.jobs = jobs;
}
public HashMap<Enchantment, Integer> getEnchants() {
return enchants;
}
public int getFromLevel() {
return fromLevel;
}

View File

@ -394,12 +394,13 @@ public class JobsListener implements Listener {
Sign sign = (Sign) block.getState();
String FirstLine = sign.getLine(0);
if (FirstLine.equalsIgnoreCase(Jobs.getLanguage().getMessage("signs.topline")))
if (FirstLine.contains(Jobs.getLanguage().getMessage("signs.topline"))) {
if (!player.hasPermission("jobs.command.signs")) {
event.setCancelled(true);
player.sendMessage(Jobs.getLanguage().getMessage("signs.cantdestroy"));
return;
}
}
Location loc = block.getLocation();
@ -685,10 +686,10 @@ public class JobsListener implements Listener {
String meinOk = null;
mein: for (JobProgression one : prog) {
for (JobLimitedItems oneItem : one.getJob().getLimitedItems().values()) {
if (one.getLevel() >= oneItem.getLevel())
for (Entry<String, JobLimitedItems> oneItem : one.getJob().getLimitedItems().entrySet()) {
if (one.getLevel() >= oneItem.getValue().getLevel())
continue;
if (!isThisItem(oneItem, iih.getType().getId(), name, lore, enchants))
if (!isThisItem(oneItem.getValue(), iih.getType().getId(), name, lore, enchants))
continue;
meinOk = one.getJob().getName();
break mein;