mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-06 16:27:59 +01:00
parent
a8dd65cb4b
commit
b1b39a789d
@ -103,7 +103,7 @@ public class GeneralConfigManager {
|
|||||||
BossBarEnabled, BossBarShowOnEachAction, BossBarsMessageByDefault, ExploreCompact, DBCleaningJobsUse, DBCleaningUsersUse,
|
BossBarEnabled, BossBarShowOnEachAction, BossBarsMessageByDefault, ExploreCompact, DBCleaningJobsUse, DBCleaningUsersUse,
|
||||||
DisabledWorldsUse, UseAsWhiteListWorldList, PaymentMethodsMoney, PaymentMethodsPoints, PaymentMethodsExp, MythicMobsEnabled,
|
DisabledWorldsUse, UseAsWhiteListWorldList, PaymentMethodsMoney, PaymentMethodsPoints, PaymentMethodsExp, MythicMobsEnabled,
|
||||||
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities,
|
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities,
|
||||||
payForEachVTradeItem, titleMessageMaxLevelReached;
|
payForEachVTradeItem, titleMessageMaxLevelReached, allowEnchantingBoostedItems;
|
||||||
|
|
||||||
public ItemStack guiBackButton, guiNextButton, guiFiller;
|
public ItemStack guiBackButton, guiNextButton, guiFiller;
|
||||||
|
|
||||||
@ -716,6 +716,9 @@ public class GeneralConfigManager {
|
|||||||
c.addComment("Economy.Enchant.PayForEnchantingOnAnvil", "Do you want to give money for enchanting items in anvil?");
|
c.addComment("Economy.Enchant.PayForEnchantingOnAnvil", "Do you want to give money for enchanting items in anvil?");
|
||||||
PayForEnchantingOnAnvil = c.get("Economy.Enchant.PayForEnchantingOnAnvil", false);
|
PayForEnchantingOnAnvil = c.get("Economy.Enchant.PayForEnchantingOnAnvil", false);
|
||||||
|
|
||||||
|
c.addComment("Economy.Enchant.AllowEnchantingBoostedItems", "Do you want to allow players to enchant their boosted items?");
|
||||||
|
allowEnchantingBoostedItems = c.get("Economy.Enchant.AllowEnchantingBoostedItems", true);
|
||||||
|
|
||||||
c.addComment("Economy.Crafting.PayForEachCraft",
|
c.addComment("Economy.Crafting.PayForEachCraft",
|
||||||
"With this true, player will get money for all crafted items instead of each crafting action (like with old payment mechanic)",
|
"With this true, player will get money for all crafted items instead of each crafting action (like with old payment mechanic)",
|
||||||
"By default its false, as you can make ALOT of money if prices kept from old payment mechanics");
|
"By default its false, as you can make ALOT of money if prices kept from old payment mechanics");
|
||||||
|
@ -45,36 +45,34 @@ public class JobItems {
|
|||||||
|
|
||||||
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) {
|
||||||
mat = mat == null ? CMIMaterial.STONE : mat;
|
mat = mat == null ? CMIMaterial.STONE : mat;
|
||||||
try {
|
|
||||||
this.enchants = enchants;
|
|
||||||
item = mat.newItemStack();
|
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
this.enchants = enchants;
|
||||||
|
item = mat.newItemStack();
|
||||||
|
|
||||||
if (name != null)
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(CMIChatColor.translate(name));
|
|
||||||
if (lore != null)
|
|
||||||
meta.setLore(lore);
|
|
||||||
|
|
||||||
if (enchants != null) {
|
if (name != null)
|
||||||
if (mat == CMIMaterial.ENCHANTED_BOOK) {
|
meta.setDisplayName(CMIChatColor.translate(name));
|
||||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
if (lore != null)
|
||||||
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
meta.setLore(lore);
|
||||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
|
||||||
}
|
if (enchants != null) {
|
||||||
} else {
|
if (mat == CMIMaterial.ENCHANTED_BOOK) {
|
||||||
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
|
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
||||||
meta.addEnchant(oneEnchant.getKey(), oneEnchant.getValue(), true);
|
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
||||||
}
|
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
|
||||||
|
meta.addEnchant(oneEnchant.getKey(), oneEnchant.getValue(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item.setItemMeta(meta);
|
|
||||||
item.setAmount(amount);
|
|
||||||
item = CMIReflections.setNbt(item, "JobsItemBoost", node);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
item.setAmount(amount);
|
||||||
|
item = CMIReflections.setNbt(item, "JobsItemBoost", node);
|
||||||
|
|
||||||
this.node = node;
|
this.node = node;
|
||||||
this.boostMultiplier = boostMultiplier;
|
this.boostMultiplier = boostMultiplier;
|
||||||
setJobs(jobs);
|
setJobs(jobs);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.gamingmesh.jobs.listeners;
|
package com.gamingmesh.jobs.listeners;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.CMILib.*;
|
import com.gamingmesh.jobs.CMILib.*;
|
||||||
|
import com.gamingmesh.jobs.ItemBoostManager;
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.actions.*;
|
import com.gamingmesh.jobs.actions.*;
|
||||||
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
||||||
@ -950,6 +951,17 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (jPlayer == null)
|
if (jPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!Jobs.getGCManager().allowEnchantingBoostedItems) {
|
||||||
|
for (JobProgression prog : jPlayer.getJobProgression()) {
|
||||||
|
for (JobItems jobItem : ItemBoostManager.getItemsByJob(prog.getJob())) {
|
||||||
|
if (event.getItem().isSimilar(jobItem.getItemStack(jPlayer.getPlayer()))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<Enchantment, Integer> enchants = event.getEnchantsToAdd();
|
Map<Enchantment, Integer> enchants = event.getEnchantsToAdd();
|
||||||
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
|
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
|
||||||
Enchantment enchant = oneEnchant.getKey();
|
Enchantment enchant = oneEnchant.getKey();
|
||||||
@ -967,8 +979,8 @@ public class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT));
|
Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT));
|
||||||
}
|
}
|
||||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT));
|
|
||||||
|
|
||||||
|
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
Loading…
Reference in New Issue
Block a user