diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java index 631763a4..cdba79f7 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java @@ -1,5 +1,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; +import com.willfp.ecoenchants.config.ConfigManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.ecoenchants.special.Soulbound; @@ -33,14 +34,21 @@ public class Telekinesis extends EcoEnchant { ); } + private static boolean always = false; + // START OF LISTENERS + @Override + protected void postUpdate() { + always = ConfigManager.getConfig().getBool("drops.force-dropqueue"); + } + // For block drops @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void telekinesisDropItem(BlockDropItemEvent event) { Player player = event.getPlayer(); - if (!EnchantChecks.mainhand(player, this)) return; + if(!always && !EnchantChecks.mainhand(player, this)) return; if(this.getDisabledWorldNames().contains(player.getWorld().getName())) return; if (event.isCancelled()) return; @@ -57,7 +65,6 @@ public class Telekinesis extends EcoEnchant { new DropQueue(player) .setLocation(block.getLocation()) .addItems(drops) - .forceTelekinesis() .push(); } @@ -67,7 +74,7 @@ public class Telekinesis extends EcoEnchant { Player player = event.getPlayer(); Block block = event.getBlock(); - if (!EnchantChecks.mainhand(player, this)) return; + if(!always && !EnchantChecks.mainhand(player, this)) return; if(this.getDisabledWorlds().contains(player.getWorld())) return; if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) @@ -83,7 +90,6 @@ public class Telekinesis extends EcoEnchant { new DropQueue(player) .setLocation(block.getLocation()) .addXP(event.getExpToDrop()) - .forceTelekinesis() .push(); event.setExpToDrop(0); diff --git a/Plugin/src/main/resources/config.yml b/Plugin/src/main/resources/config.yml index 0f45280a..650ab364 100644 --- a/Plugin/src/main/resources/config.yml +++ b/Plugin/src/main/resources/config.yml @@ -104,4 +104,8 @@ drops: collate: false # Instead of directly dropping all drops and xp, some intensive enchantments (eg Telekinesis and Infernal Touch) will push to a collated queue. # At the end of each tick, the queue will be pushed rather than pushing on every drop creation - # This will massively improve mining performance on servers, however it is experimental and may not function correctly. \ No newline at end of file + # This will massively improve mining performance on servers, however it is experimental and may not function correctly. + 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 \ No newline at end of file