From 10b4ed559cad73a08b8523dd237166d60ee8939d Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 2 Aug 2021 14:45:28 +0100 Subject: [PATCH] Added particle-amount option to villagers --- .../enchantments/support/obtaining/VillagerListeners.java | 6 +++--- eco-core/core-plugin/src/main/resources/config.yml | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java index dda059b3..9e0bf8e8 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java @@ -118,7 +118,7 @@ public class VillagerListeners extends PluginDependent implements Lis recipe.setIngredients(ingredients); event.setRecipe(recipe); - if (this.getPlugin().getConfigYml().getBool("villager.notify-on-special")) { + if (this.getPlugin().getConfigYml().getBool("villager.notify-on-special.enabled")) { if (applied.getType().equals(EnchantmentType.SPECIAL)) { showParticles(event.getEntity()); } @@ -236,7 +236,7 @@ public class VillagerListeners extends PluginDependent implements Lis recipe.setIngredients(ingredients); event.setRecipe(recipe); - if (this.getPlugin().getConfigYml().getBool("villager.notify-on-special")) { + if (this.getPlugin().getConfigYml().getBool("villager.notify-on-special.enabled")) { if (toAdd.keySet().stream().anyMatch(enchant -> enchant.getType().equals(EnchantmentType.SPELL))) { showParticles(event.getEntity()); } @@ -256,7 +256,7 @@ public class VillagerListeners extends PluginDependent implements Lis location.add(0, 1, 0); - int limit = NumberUtils.randInt(8, 13); + int limit = this.getPlugin().getConfigYml().getInt("villager.notify-on-special.particle-amount"); for (int i = 0; i < limit; i++) { Location spawnLoc = location.clone(); diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index a1bf6d63..48042559 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -86,7 +86,9 @@ enchanting-table: villager: enabled: true # Enable EcoEnchants through villagers book-times-less-likely: 7 # Times less likely to get an enchantment from a book with a villager. Recommended to be higher as books can only have one enchantment on them. - notify-on-special: true # Show particles when the villager unlocks a special enchantment trade + notify-on-special: # Show particles when the villager unlocks a special enchantment trade + enabled: true + particle-amount: 14 reduce-probability: # Reduce probability of adding new enchantment by factor after each enchantment added. Does not apply to books as they only ever contain one enchantment. enabled: true # Enable reduction