Updated config and allowed enchantments to work on npcs with a config optoin

This commit is contained in:
Auxilor 2021-03-24 18:40:20 +00:00
parent 65475f6f93
commit a5cef9c1ff
4 changed files with 21 additions and 6 deletions

View File

@ -204,7 +204,8 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
EnchantmentTarget.class,
EcoEnchants.class,
TabCompleterEnchantinfo.class,
EnchantmentType.class
EnchantmentType.class,
WatcherTriggers.class
);
}

View File

@ -41,7 +41,7 @@ public class Telekinesis extends EcoEnchant {
@Override
protected void postUpdate() {
always = this.getPlugin().getConfigYml().getBool("drops.force-dropqueue");
always = this.getPlugin().getConfigYml().getBool("advanced.force-dropqueue");
}
// For block drops

View File

@ -2,11 +2,13 @@ package com.willfp.ecoenchants.enchantments.util;
import com.google.common.collect.Sets;
import com.willfp.eco.util.TridentUtils;
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
import com.willfp.eco.util.integrations.antigrief.AntigriefManager;
import com.willfp.eco.util.integrations.mcmmo.McmmoManager;
import com.willfp.eco.util.internal.PluginDependent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -47,6 +49,11 @@ public class WatcherTriggers extends PluginDependent implements Listener {
*/
private static final DecimalFormat FORMAT = new DecimalFormat("0.00");
/**
* If watchers should be triggered against npcs.
*/
private static boolean allowOnNPC = false;
/**
* Create new listener for watcher events.
*
@ -718,4 +725,12 @@ public class WatcherTriggers extends PluginDependent implements Listener {
enchant.onDeflect(blocker, attacker, level, event);
});
}
/**
* Update if allowed on npc.
*/
@ConfigUpdater
public static void update() {
allowOnNPC = EcoEnchantsPlugin.getInstance().getConfig().getBoolean("allow-on-npc");
}
}

View File

@ -3,6 +3,8 @@
# by Auxilor
#
allow-on-npc: false # If enchantments should activate against NPCs.
commands:
enchantinfo:
show-target-group: true # Show name of target group rather than individual items
@ -102,14 +104,11 @@ rarity:
vanilla-treasure-rarity: legendary # Treasure enchantments do not appear in vanilla enchanting tables (Mending, Soul Speed, Frost Walker)
# The above options *do not* affect actual enchantment rarities. They are purely for cosmetic purposes, like in item lores.
drops:
### ADVANCED OPTIONS
advanced:
force-dropqueue: true
# When combined with collate, this massively reduces calls to getItemMeta, which can hurt performance when many enchants are on an item.
# Without collate, the number of calls may be increased - which will further hurt performance
# Enabling this option makes all drops go through telekinesis listeners
advanced:
lore-getter:
# This converts enchantments with matching names from other enchantment plugins from lore into real enchantments.
# This is experimental not recommended to be used for extended periods of time: enchantments are automatically converted.