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

Add config option for preventing enchantments on shop items

This commit is contained in:
Gamer153 2022-07-27 16:59:49 +02:00
parent 2cb31390d2
commit b9f5b40b46
No known key found for this signature in database
GPG Key ID: 1A66BA80EBD24A0A
2 changed files with 8 additions and 1 deletions

View File

@ -102,7 +102,7 @@ public class GeneralConfigManager {
BossBarEnabled = false, BossBarShowOnEachAction = false, BossBarsMessageByDefault = false, ExploreCompact, DBCleaningJobsUse, DBCleaningUsersUse,
DisabledWorldsUse, UseAsWhiteListWorldList, PaymentMethodsMoney, PaymentMethodsPoints, PaymentMethodsExp, MythicMobsEnabled,
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false,
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false;
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
public ItemStack guiBackButton, guiNextButton;
public CMIMaterial guiFiller;
@ -440,6 +440,9 @@ public class GeneralConfigManager {
c.addComment("hide-jobsinfo-without-permission", "Hide jobs info from player if they lack the permission to join the job");
hideJobsInfoWithoutPermission = c.get("hide-jobsinfo-without-permission", false);
c.addComment("prevent-shop-item-enchanting", "Prevent players to enchant items from the shop in the anvil with enchanted books");
preventShopItemEnchanting = c.get("prevent-shop-item-enchanting", true);
c.addComment("enable-pay-near-spawner",
"Option to allow payment to be made when killing mobs from a spawner.",
"Use jobs.nearspawner.[amount] to define multiplayer. Example jobs.nearspawner.-0.5 will pay half of payment, jobs.nearspawner.-1 will not pay at all");

View File

@ -26,6 +26,7 @@ import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import com.gamingmesh.jobs.config.GeneralConfigManager;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -1082,6 +1083,9 @@ public final class JobsPaymentListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void PrepareAnvilEvent(final PrepareAnvilEvent event) {
if (!Jobs.getGCManager().preventShopItemEnchanting)
return;
if (!Jobs.getPlayerManager().containsItemBoostByNBT(event.getInventory().getContents()[0]))
return;