mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-27 20:37:34 +01:00
Added check limits for Aiming
This commit is contained in:
parent
e5aacc2ef8
commit
e3c1345672
@ -18,6 +18,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class Aiming extends EcoEnchant {
|
||||
@ -91,12 +92,18 @@ public final class Aiming extends EcoEnchant {
|
||||
}
|
||||
};
|
||||
|
||||
final int period = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "check-ticks");
|
||||
final int checks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "checks-per-level") * level;
|
||||
AtomicInteger checksPerformed = new AtomicInteger(0);
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checksPerformed.addAndGet(1);
|
||||
if(checksPerformed.get() > checks) this.cancel();
|
||||
if(arrow.isDead() || arrow.isInBlock() || arrow.isOnGround()) this.cancel();
|
||||
Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), runnable);
|
||||
}
|
||||
}.runTaskTimer(EcoEnchantsPlugin.getInstance(), 3, 5);
|
||||
}.runTaskTimer(EcoEnchantsPlugin.getInstance(), 3, period);
|
||||
}
|
||||
}
|
||||
|
@ -22,4 +22,6 @@ general-config:
|
||||
config:
|
||||
distance-per-level: 4 # Distance to scan per aiming level
|
||||
scale-on-force: true # Scale distance based on bow pull
|
||||
require-full-force: true # Require full bow pull (works with rapid) If true, then scale-on-force is irrelevant.
|
||||
require-full-force: true # Require full bow pull (works with rapid) If true, then scale-on-force is irrelevant.
|
||||
check-ticks: 10 # Ticks between rotations
|
||||
checks-per-level: 2 # Amount of times to rotate arrow per level (prevents "floating")
|
Loading…
Reference in New Issue
Block a user