mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Added force-dropqueue
This commit is contained in:
parent
47f84d4124
commit
70a596ee1e
@ -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);
|
||||
|
@ -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.
|
||||
# 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
|
Loading…
Reference in New Issue
Block a user