From ad63adcac9a17ccf416a07a16a7bca6359b1a8e5 Mon Sep 17 00:00:00 2001 From: nulli0n Date: Tue, 26 Nov 2024 12:56:20 +0500 Subject: [PATCH] v4.3.1 --- API/pom.xml | 2 +- .../excellentenchants/api/ConfigBridge.java | 46 +++++++++++++++++++ Core/pom.xml | 10 ++-- .../excellentenchants/EnchantsPlugin.java | 6 +++ .../excellentenchants/config/Config.java | 35 ++++++++++++++ .../impl/armor/FireShieldEnchant.java | 10 ++-- .../impl/armor/IceShieldEnchant.java | 8 ++-- .../impl/fishing/CurseOfDrownedEnchant.java | 6 +-- .../impl/tool/ReplanterEnchant.java | 6 +-- .../enchantment/impl/tool/SmelterEnchant.java | 14 ++---- .../impl/universal/RestoreEnchant.java | 8 ++-- .../impl/weapon/CutterEnchant.java | 6 +-- .../impl/weapon/DoubleStrikeEnchant.java | 6 +-- .../impl/weapon/IceAspectEnchant.java | 8 ++-- .../impl/weapon/RocketEnchant.java | 6 +-- .../enchantment/listener/AnvilListener.java | 4 +- MC_1_21/pom.xml | 6 +-- .../excellentenchants/Internal_1_21.java | 13 +++--- MC_1_21_3/pom.xml | 6 +-- .../nms/Internal_1_21_3.java | 13 +++--- NMS/pom.xml | 4 +- pom.xml | 2 +- 22 files changed, 155 insertions(+), 70 deletions(-) diff --git a/API/pom.xml b/API/pom.xml index 1327f15..d843f5a 100644 --- a/API/pom.xml +++ b/API/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 4.3.0 + 4.3.1 4.0.0 diff --git a/API/src/main/java/su/nightexpress/excellentenchants/api/ConfigBridge.java b/API/src/main/java/su/nightexpress/excellentenchants/api/ConfigBridge.java index 963f831..666920c 100644 --- a/API/src/main/java/su/nightexpress/excellentenchants/api/ConfigBridge.java +++ b/API/src/main/java/su/nightexpress/excellentenchants/api/ConfigBridge.java @@ -4,6 +4,12 @@ public class ConfigBridge { private static int enchantsTickInterval; + private static boolean globalDistEnchanting; + private static boolean globalDistTrading; + private static boolean globalDistMobEquipment; + private static boolean globalDistTradeEquipment; + private static boolean globalDistRandomLoot; + public static int getEnchantsTickInterval() { return enchantsTickInterval; } @@ -11,4 +17,44 @@ public class ConfigBridge { public static void setEnchantsTickInterval(int enchantsTickInterval) { ConfigBridge.enchantsTickInterval = enchantsTickInterval; } + + public static boolean isGlobalDistEnchanting() { + return globalDistEnchanting; + } + + public static void setGlobalDistEnchanting(boolean globalDistEnchanting) { + ConfigBridge.globalDistEnchanting = globalDistEnchanting; + } + + public static boolean isGlobalDistTrading() { + return globalDistTrading; + } + + public static void setGlobalDistTrading(boolean globalDistTrading) { + ConfigBridge.globalDistTrading = globalDistTrading; + } + + public static boolean isGlobalDistMobEquipment() { + return globalDistMobEquipment; + } + + public static void setGlobalDistMobEquipment(boolean globalDistMobEquipment) { + ConfigBridge.globalDistMobEquipment = globalDistMobEquipment; + } + + public static boolean isGlobalDistTradeEquipment() { + return globalDistTradeEquipment; + } + + public static void setGlobalDistTradeEquipment(boolean globalDistTradeEquipment) { + ConfigBridge.globalDistTradeEquipment = globalDistTradeEquipment; + } + + public static boolean isGlobalDistRandomLoot() { + return globalDistRandomLoot; + } + + public static void setGlobalDistRandomLoot(boolean globalDistRandomLoot) { + ConfigBridge.globalDistRandomLoot = globalDistRandomLoot; + } } diff --git a/Core/pom.xml b/Core/pom.xml index 117a679..de9a3aa 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 4.3.0 + 4.3.1 4.0.0 @@ -89,25 +89,25 @@ su.nightexpress.excellentenchants API - 4.3.0 + 4.3.1 su.nightexpress.excellentenchants NMS - 4.3.0 + 4.3.1 su.nightexpress.excellentenchants MC_1_21_3 - 4.3.0 + 4.3.1 su.nightexpress.excellentenchants MC_1_21 - 4.3.0 + 4.3.1 diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/EnchantsPlugin.java b/Core/src/main/java/su/nightexpress/excellentenchants/EnchantsPlugin.java index 44491bd..7e81666 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/EnchantsPlugin.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/EnchantsPlugin.java @@ -98,7 +98,13 @@ public class EnchantsPlugin extends NightPlugin implements ImprovedCommands { private void loadAPI() { EnchantsAPI.load(this); Keys.loadKeys(this); + ConfigBridge.setEnchantsTickInterval(Config.CORE_PASSIVE_ENCHANTS_TRIGGER_INTERVAL.get().intValue()); + ConfigBridge.setGlobalDistEnchanting(Config.ENCHANTMENTS_GLOBAL_DIST_ENCHANTING.get()); + ConfigBridge.setGlobalDistTrading(Config.ENCHANTMENTS_GLOBAL_DIST_TRADING.get()); + ConfigBridge.setGlobalDistMobEquipment(Config.ENCHANTMENTS_GLOBAL_DIST_MOB_EQUIPMENT.get()); + ConfigBridge.setGlobalDistTradeEquipment(Config.ENCHANTMENTS_GLOBAL_DIST_TRADE_EQUIPMENT.get()); + ConfigBridge.setGlobalDistRandomLoot(Config.ENCHANTMENTS_GLOBAL_DIST_RANDOM_LOOT.get()); } private void loadHooks() { diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/config/Config.java b/Core/src/main/java/su/nightexpress/excellentenchants/config/Config.java index 160df71..1c64243 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/config/Config.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/config/Config.java @@ -71,6 +71,41 @@ public class Config { + public static final ConfigValue ENCHANTMENTS_GLOBAL_DIST_ENCHANTING = ConfigValue.create("Enchantments.Global_Distribution.Enchanting_Table", + true, + "Controls whether excellent enchants can be obtained via enchanting table.", + "[*] Server reboot required.", + "[Default is true]" + ); + + public static final ConfigValue ENCHANTMENTS_GLOBAL_DIST_TRADING = ConfigValue.create("Enchantments.Global_Distribution.Trading", + true, + "Controls whether excellent enchants can be obtained via trading with villagers.", + "[*] Server reboot required.", + "[Default is true]" + ); + + public static final ConfigValue ENCHANTMENTS_GLOBAL_DIST_MOB_EQUIPMENT = ConfigValue.create("Enchantments.Global_Distribution.Mob_Equipment", + true, + "Controls whether excellent enchants can be populated on mob's equipment.", + "[*] Server reboot required.", + "[Default is true]" + ); + + public static final ConfigValue ENCHANTMENTS_GLOBAL_DIST_TRADE_EQUIPMENT = ConfigValue.create("Enchantments.Global_Distribution.Trade_Equipment", + true, + "Controls whether excellent enchants can be populated on traded equipment.", + "[*] Server reboot required.", + "[Default is true]" + ); + + public static final ConfigValue ENCHANTMENTS_GLOBAL_DIST_RANDOM_LOOT = ConfigValue.create("Enchantments.Global_Distribution.Random_Loot", + true, + "Controls whether excellent enchants can be populated on random loot.", + "[*] Server reboot required.", + "[Default is true]" + ); + public static final ConfigValue> ENCHANTMENTS_DISABLED_LIST = ConfigValue.forSet("Enchantments.Disabled.List", String::toLowerCase, FileConfig::set, diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/FireShieldEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/FireShieldEnchant.java index 6975ab2..561e8f8 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/FireShieldEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/FireShieldEnchant.java @@ -11,20 +11,20 @@ import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.NotNull; import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; -import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; -import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; import su.nightexpress.excellentenchants.api.enchantment.TradeType; +import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; +import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.ConfigValue; import su.nightexpress.nightcore.config.FileConfig; import su.nightexpress.nightcore.util.NumberUtil; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.wrapper.UniParticle; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; @@ -105,7 +105,7 @@ public class FireShieldEnchant extends GameEnchantment implements ChanceMeta, Co if (this.hasVisualEffects()) { UniParticle.of(Particle.FLAME).play(victim.getEyeLocation(), 0.5, 0.1, 35); - UniSound.of(Sound.ITEM_FIRECHARGE_USE).play(victim.getLocation()); + NightSound.of(Sound.ITEM_FIRECHARGE_USE).play(victim.getLocation()); } damager.setFireTicks(fireTicks); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/IceShieldEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/IceShieldEnchant.java index d8b3300..33c6646 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/IceShieldEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/IceShieldEnchant.java @@ -13,18 +13,18 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.PotionEffects; import su.nightexpress.excellentenchants.api.enchantment.meta.PotionMeta; import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; -import su.nightexpress.excellentenchants.api.enchantment.meta.PotionEffects; import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.excellentenchants.rarity.EnchantRarity; +import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.FileConfig; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.wrapper.UniParticle; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; @@ -79,7 +79,7 @@ public class IceShieldEnchant extends GameEnchantment implements ChanceMeta, Pot if (this.hasVisualEffects()) { UniParticle.blockCrack(Material.ICE).play(victim.getEyeLocation(), 0.5, 0.1, 35); UniParticle.of(Particle.CLOUD).play(victim.getEyeLocation(), 0.25, 0.1, 25); - UniSound.of(Sound.BLOCK_GLASS_BREAK).play(victim.getLocation()); + NightSound.of(Sound.BLOCK_GLASS_BREAK).play(victim.getLocation()); } return true; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java index b0732a1..7559a49 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/fishing/CurseOfDrownedEnchant.java @@ -11,16 +11,16 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.api.enchantment.type.FishingEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.FileConfig; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.wrapper.UniParticle; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; @@ -68,7 +68,7 @@ public class CurseOfDrownedEnchant extends GameEnchantment implements FishingEnc if (this.hasVisualEffects()) { UniParticle.of(Particle.UNDERWATER).play(hook.getLocation(), 0.75, 0.1, 50); - UniSound.of(Sound.ENTITY_DROWNED_AMBIENT).play(event.getPlayer()); + NightSound.of(Sound.ENTITY_DROWNED_AMBIENT).play(event.getPlayer()); } return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/ReplanterEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/ReplanterEnchant.java index cc140e9..8bca261 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/ReplanterEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/ReplanterEnchant.java @@ -18,17 +18,17 @@ import org.jetbrains.annotations.NotNull; import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant; import su.nightexpress.excellentenchants.api.enchantment.type.InteractEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.ConfigValue; import su.nightexpress.nightcore.config.FileConfig; -import su.nightexpress.nightcore.util.wrapper.UniSound; +import su.nightexpress.nightcore.util.bukkit.NightSound; import java.io.File; import java.util.Set; @@ -133,7 +133,7 @@ public class ReplanterEnchant extends GameEnchantment implements ChanceMeta, Int if (seed == Material.NETHER_WART && blockGround.getType() == Material.SOUL_SAND || seed != Material.NETHER_WART && blockGround.getType() == Material.FARMLAND) { if (this.takeSeeds(player, seed)) { - UniSound.of(seed == Material.NETHER_WART ? Sound.ITEM_NETHER_WART_PLANT : Sound.ITEM_CROP_PLANT).play(player); + NightSound.of(seed == Material.NETHER_WART ? Sound.ITEM_NETHER_WART_PLANT : Sound.ITEM_CROP_PLANT).play(player); plugin.getEnchantNMS().sendAttackPacket(player, 0); blockPlant.setType(this.fineSeedsToBlock(seed)); break; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/SmelterEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/SmelterEnchant.java index b00636e..35d0dac 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/SmelterEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/tool/SmelterEnchant.java @@ -18,11 +18,11 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.api.enchantment.type.BlockDropEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.ConfigValue; @@ -30,8 +30,8 @@ import su.nightexpress.nightcore.config.FileConfig; import su.nightexpress.nightcore.util.BukkitThing; import su.nightexpress.nightcore.util.Lists; import su.nightexpress.nightcore.util.LocationUtil; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.wrapper.UniParticle; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; import java.util.ArrayList; @@ -45,8 +45,8 @@ public class SmelterEnchant extends GameEnchantment implements ChanceMeta, Block public static final String ID = "smelter"; - private UniSound sound; - private boolean disableOnCrouch; + private NightSound sound; + private boolean disableOnCrouch; private final Set exemptedItems; private final Set recipes; @@ -82,11 +82,7 @@ public class SmelterEnchant extends GameEnchantment implements ChanceMeta, Block "Sets whether or not enchantment will have no effect when crouching." ).read(config); - this.sound = ConfigValue.create("Settings.Sound", - UniSound.of(Sound.BLOCK_LAVA_EXTINGUISH), - "Sound to play on smelting.", - "https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html" - ).read(config); + this.sound = ConfigValue.create("Settings.Sound", NightSound.of(Sound.BLOCK_LAVA_EXTINGUISH), "Sound to play on smelting.").read(config); this.exemptedItems.addAll(ConfigValue.forSet("Settings.Exempted_Blocks", BukkitThing::getMaterial, diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/RestoreEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/RestoreEnchant.java index 6872325..d308a9f 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/RestoreEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/RestoreEnchant.java @@ -11,18 +11,18 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.api.enchantment.type.GenericEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; -import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.excellentenchants.util.EnchantUtils; +import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.FileConfig; import su.nightexpress.nightcore.manager.SimpeListener; import su.nightexpress.nightcore.util.NumberUtil; -import su.nightexpress.nightcore.util.wrapper.UniSound; +import su.nightexpress.nightcore.util.bukkit.NightSound; import java.io.File; @@ -90,7 +90,7 @@ public class RestoreEnchant extends GameEnchantment implements GenericEnchant, C EnchantUtils.remove(item, this.getBukkitEnchantment()); if (this.hasVisualEffects()) { - UniSound.of(Sound.ITEM_TOTEM_USE).play(event.getPlayer()); + NightSound.of(Sound.ITEM_TOTEM_USE).play(event.getPlayer()); } } } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/CutterEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/CutterEnchant.java index c29ae0f..138a79e 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/CutterEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/CutterEnchant.java @@ -15,19 +15,19 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.ConfigValue; import su.nightexpress.nightcore.config.FileConfig; import su.nightexpress.nightcore.util.NumberUtil; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.random.Rnd; import su.nightexpress.nightcore.util.wrapper.UniParticle; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; @@ -117,7 +117,7 @@ public class CutterEnchant extends GameEnchantment implements ChanceMeta, Combat if (this.hasVisualEffects()) { UniParticle.itemCrack(itemCut).play(victim.getEyeLocation(), 0.25, 0.15, 30); - UniSound.of(Sound.ENTITY_ITEM_BREAK).play(victim.getLocation()); + NightSound.of(Sound.ENTITY_ITEM_BREAK).play(victim.getLocation()); } return true; diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/DoubleStrikeEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/DoubleStrikeEnchant.java index f61c6a1..ecdb10d 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/DoubleStrikeEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/DoubleStrikeEnchant.java @@ -11,16 +11,16 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.FileConfig; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.wrapper.UniParticle; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; @@ -63,7 +63,7 @@ public class DoubleStrikeEnchant extends GameEnchantment implements ChanceMeta, if (this.hasVisualEffects()) { UniParticle.of(Particle.EXPLOSION).play(victim.getEyeLocation(), 0.25, 0.15, 15); - UniSound.of(Sound.ENTITY_GENERIC_EXPLODE).play(victim.getLocation()); + NightSound.of(Sound.ENTITY_GENERIC_EXPLODE).play(victim.getLocation()); } return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/IceAspectEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/IceAspectEnchant.java index 458dde8..7e910a4 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/IceAspectEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/IceAspectEnchant.java @@ -13,18 +13,18 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.PotionEffects; import su.nightexpress.excellentenchants.api.enchantment.meta.PotionMeta; import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; -import su.nightexpress.excellentenchants.api.enchantment.meta.PotionEffects; import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.excellentenchants.rarity.EnchantRarity; +import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.FileConfig; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.wrapper.UniParticle; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; @@ -74,7 +74,7 @@ public class IceAspectEnchant extends GameEnchantment implements ChanceMeta, Pot if (this.hasVisualEffects()) { UniParticle.blockCrack(Material.ICE).play(victim.getEyeLocation(), 0.5, 0.1, 35); UniParticle.of(Particle.CLOUD).play(victim.getEyeLocation(), 0.25, 0.1, 25); - UniSound.of(Sound.BLOCK_GLASS_BREAK).play(victim.getLocation()); + NightSound.of(Sound.BLOCK_GLASS_BREAK).play(victim.getLocation()); } return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/RocketEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/RocketEnchant.java index 0aca7af..5ffdbe3 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/RocketEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/weapon/RocketEnchant.java @@ -13,16 +13,16 @@ import su.nightexpress.excellentenchants.EnchantsPlugin; import su.nightexpress.excellentenchants.api.Modifier; import su.nightexpress.excellentenchants.api.enchantment.TradeType; import su.nightexpress.excellentenchants.api.enchantment.meta.ChanceMeta; +import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.api.enchantment.type.CombatEnchant; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDefinition; import su.nightexpress.excellentenchants.enchantment.impl.EnchantDistribution; import su.nightexpress.excellentenchants.enchantment.impl.GameEnchantment; -import su.nightexpress.excellentenchants.api.enchantment.meta.Probability; import su.nightexpress.excellentenchants.rarity.EnchantRarity; import su.nightexpress.excellentenchants.util.ItemCategories; import su.nightexpress.nightcore.config.FileConfig; +import su.nightexpress.nightcore.util.bukkit.NightSound; import su.nightexpress.nightcore.util.random.Rnd; -import su.nightexpress.nightcore.util.wrapper.UniSound; import java.io.File; @@ -78,7 +78,7 @@ public class RocketEnchant extends GameEnchantment implements ChanceMeta, Combat Firework firework = this.createRocket(victim.getWorld(), victim.getLocation(), level); firework.addPassenger(victim); - UniSound.of(Sound.ENTITY_FIREWORK_ROCKET_LAUNCH).play(victim.getLocation()); + NightSound.of(Sound.ENTITY_FIREWORK_ROCKET_LAUNCH).play(victim.getLocation()); return true; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/AnvilListener.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/AnvilListener.java index e6920fa..e6d0fc6 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/AnvilListener.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/listener/AnvilListener.java @@ -19,7 +19,7 @@ import su.nightexpress.excellentenchants.config.Keys; import su.nightexpress.excellentenchants.util.EnchantUtils; import su.nightexpress.nightcore.manager.AbstractListener; import su.nightexpress.nightcore.util.PDCUtil; -import su.nightexpress.nightcore.util.wrapper.UniSound; +import su.nightexpress.nightcore.util.bukkit.NightSound; import java.util.HashMap; import java.util.Map; @@ -176,7 +176,7 @@ public class AnvilListener extends AbstractListener { event.getView().setCursor(item); event.setCancelled(false); - UniSound.of(Sound.BLOCK_ENCHANTMENT_TABLE_USE).play(player); + NightSound.of(Sound.BLOCK_ENCHANTMENT_TABLE_USE).play(player); ItemStack second = anvilInventory.getItem(1); if (second != null && !second.getType().isAir()) { diff --git a/MC_1_21/pom.xml b/MC_1_21/pom.xml index fae1462..c324ec8 100644 --- a/MC_1_21/pom.xml +++ b/MC_1_21/pom.xml @@ -6,7 +6,7 @@ su.nightexpress.excellentenchants ExcellentEnchants - 4.3.0 + 4.3.1 MC_1_21 @@ -28,13 +28,13 @@ su.nightexpress.excellentenchants API - 4.3.0 + 4.3.1 su.nightexpress.excellentenchants NMS - 4.3.0 + 4.3.1 diff --git a/MC_1_21/src/main/java/su/nightexpress/excellentenchants/Internal_1_21.java b/MC_1_21/src/main/java/su/nightexpress/excellentenchants/Internal_1_21.java index 12ab149..ff489a9 100644 --- a/MC_1_21/src/main/java/su/nightexpress/excellentenchants/Internal_1_21.java +++ b/MC_1_21/src/main/java/su/nightexpress/excellentenchants/Internal_1_21.java @@ -51,6 +51,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; +import su.nightexpress.excellentenchants.api.ConfigBridge; import su.nightexpress.excellentenchants.api.enchantment.*; import su.nightexpress.excellentenchants.api.enchantment.bridge.FlameWalker; import su.nightexpress.excellentenchants.nms.EnchantNMS; @@ -199,31 +200,31 @@ public class Internal_1_21 implements EnchantNMS { else addInTag(EnchantmentTags.NON_TREASURE, reference); // Any enchantment can be on random loot. - if (distribution.isOnRandomLoot()) { + if (distribution.isOnRandomLoot() && ConfigBridge.isGlobalDistRandomLoot()) { addInTag(EnchantmentTags.ON_RANDOM_LOOT, reference); } // Only non-treasure enchantments should be on mob equipment, traded equipment and non-rebalanced trades. if (!distribution.isTreasure()) { - if (distribution.isOnMobSpawnEquipment()) { + if (distribution.isOnMobSpawnEquipment() && ConfigBridge.isGlobalDistMobEquipment()) { addInTag(EnchantmentTags.ON_MOB_SPAWN_EQUIPMENT, reference); } - if (distribution.isOnTradedEquipment()) { + if (distribution.isOnTradedEquipment() && ConfigBridge.isGlobalDistTradeEquipment()) { addInTag(EnchantmentTags.ON_TRADED_EQUIPMENT, reference); } } // Any enchantment can be tradable. if (experimentalTrades) { - if (distribution.isTradable()) { + if (distribution.isTradable() && ConfigBridge.isGlobalDistTrading()) { distribution.getTrades().forEach(tradeType -> { addInTag(getTradeKey(tradeType), reference); }); } } else { - if (distribution.isTradable()) { + if (distribution.isTradable() && ConfigBridge.isGlobalDistTrading()) { addInTag(EnchantmentTags.TRADEABLE, reference); } else removeFromTag(EnchantmentTags.TRADEABLE, reference); @@ -235,7 +236,7 @@ public class Internal_1_21 implements EnchantNMS { else { // Only non-curse and non-treasure enchantments should go in enchanting table. if (!distribution.isTreasure()) { - if (distribution.isDiscoverable()) { + if (distribution.isDiscoverable() && ConfigBridge.isGlobalDistEnchanting()) { addInTag(EnchantmentTags.IN_ENCHANTING_TABLE, reference); } else removeFromTag(EnchantmentTags.IN_ENCHANTING_TABLE, reference); diff --git a/MC_1_21_3/pom.xml b/MC_1_21_3/pom.xml index c9cee46..a795de9 100644 --- a/MC_1_21_3/pom.xml +++ b/MC_1_21_3/pom.xml @@ -6,7 +6,7 @@ su.nightexpress.excellentenchants ExcellentEnchants - 4.3.0 + 4.3.1 MC_1_21_3 @@ -28,13 +28,13 @@ su.nightexpress.excellentenchants API - 4.3.0 + 4.3.1 su.nightexpress.excellentenchants NMS - 4.3.0 + 4.3.1 diff --git a/MC_1_21_3/src/main/java/su/nightexpress/excellentenchants/nms/Internal_1_21_3.java b/MC_1_21_3/src/main/java/su/nightexpress/excellentenchants/nms/Internal_1_21_3.java index bdb56a0..377b5b4 100644 --- a/MC_1_21_3/src/main/java/su/nightexpress/excellentenchants/nms/Internal_1_21_3.java +++ b/MC_1_21_3/src/main/java/su/nightexpress/excellentenchants/nms/Internal_1_21_3.java @@ -48,6 +48,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; +import su.nightexpress.excellentenchants.api.ConfigBridge; import su.nightexpress.excellentenchants.api.enchantment.*; import su.nightexpress.excellentenchants.api.enchantment.bridge.FlameWalker; import su.nightexpress.nightcore.NightPlugin; @@ -270,31 +271,31 @@ public class Internal_1_21_3 implements EnchantNMS { else addInTag(EnchantmentTags.NON_TREASURE, reference); // Any enchantment can be on random loot. - if (distribution.isOnRandomLoot()) { + if (distribution.isOnRandomLoot() && ConfigBridge.isGlobalDistRandomLoot()) { addInTag(EnchantmentTags.ON_RANDOM_LOOT, reference); } // Only non-treasure enchantments should be on mob equipment, traded equipment and non-rebalanced trades. if (!distribution.isTreasure()) { - if (distribution.isOnMobSpawnEquipment()) { + if (distribution.isOnMobSpawnEquipment() && ConfigBridge.isGlobalDistMobEquipment()) { addInTag(EnchantmentTags.ON_MOB_SPAWN_EQUIPMENT, reference); } - if (distribution.isOnTradedEquipment()) { + if (distribution.isOnTradedEquipment() && ConfigBridge.isGlobalDistTradeEquipment()) { addInTag(EnchantmentTags.ON_TRADED_EQUIPMENT, reference); } } // Any enchantment can be tradable. if (experimentalTrades) { - if (distribution.isTradable()) { + if (distribution.isTradable() && ConfigBridge.isGlobalDistTrading()) { distribution.getTrades().forEach(tradeType -> { addInTag(getTradeKey(tradeType), reference); }); } } else { - if (distribution.isTradable()) { + if (distribution.isTradable() && ConfigBridge.isGlobalDistTrading()) { addInTag(EnchantmentTags.TRADEABLE, reference); } else removeFromTag(EnchantmentTags.TRADEABLE, reference); @@ -306,7 +307,7 @@ public class Internal_1_21_3 implements EnchantNMS { else { // Only non-curse and non-treasure enchantments should go in enchanting table. if (!distribution.isTreasure()) { - if (distribution.isDiscoverable()) { + if (distribution.isDiscoverable() && ConfigBridge.isGlobalDistEnchanting()) { addInTag(EnchantmentTags.IN_ENCHANTING_TABLE, reference); } else removeFromTag(EnchantmentTags.IN_ENCHANTING_TABLE, reference); diff --git a/NMS/pom.xml b/NMS/pom.xml index 170b3c7..790380c 100644 --- a/NMS/pom.xml +++ b/NMS/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 4.3.0 + 4.3.1 4.0.0 @@ -34,7 +34,7 @@ su.nightexpress.excellentenchants API - 4.3.0 + 4.3.1 diff --git a/pom.xml b/pom.xml index 8f72787..8125af3 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ su.nightexpress.excellentenchants ExcellentEnchants pom - 4.3.0 + 4.3.1 API Core