mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Jobs shop items now use enchants
- Fix level no job error message path not found
This commit is contained in:
parent
f9ebb0bec3
commit
472112377f
@ -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);
|
||||
|
||||
|
@ -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.");
|
||||
|
@ -415,7 +415,7 @@ public class ShopManager {
|
||||
|
||||
String id = null;
|
||||
if (itemSection.isString("Id"))
|
||||
id = itemSection.getString("Id");
|
||||
id = itemSection.getString("Id");
|
||||
else {
|
||||
Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid GiveItems name property. Skipping!");
|
||||
continue;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
@ -739,7 +740,7 @@ public class JobsListener implements Listener {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
if (event.getPlayer() == null || !event.getPlayer().isOnline())
|
||||
return;
|
||||
return;
|
||||
|
||||
//disabling plugin in world
|
||||
if (event.getTo() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getTo().getWorld()))
|
||||
|
Loading…
Reference in New Issue
Block a user