package mineplex.game.clans.items.legendaries; import mineplex.game.clans.items.generation.ValueDistribution; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; public class HyperBlade extends LegendaryItem { private static ValueDistribution amountGen = generateDistribution(0, 3); // [1, 4] speed amount private static ValueDistribution durationGen = generateDistribution(80, 320); // [4, 16] seconds speed duration private int _speedAmount; private int _speedDuration; public HyperBlade() { _speedAmount = amountGen.generateIntValue(); _speedDuration = durationGen.generateIntValue(); } @Override public void update(Player wielder) { if (isHoldingRightClick() && canBuff()) { buffPlayer(wielder); } } @Override public void onAttack(EntityDamageByEntityEvent event, Player wielder) { // TODO: Reduce after-attack cooldown against players to 100ms (instead of 400ms) } private void buffPlayer(Player wielder) { // Give player speed buff wielder.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, _speedAmount, _speedDuration)); } private boolean canBuff() { return true; // TODO: Implement cooldown? (None specified in docs, sounds OP) } }