mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
!Vector ability result, removed useless method
This commit is contained in:
parent
3cd9899ef2
commit
084565f600
@ -9,10 +9,7 @@ import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
@ -42,13 +39,6 @@ public abstract class Ability {
|
||||
this.allowedModes = Arrays.asList(allowedModes);
|
||||
}
|
||||
|
||||
public static Ability getCorrespondingAbility(String name) {
|
||||
for (Ability ability : MMOItems.plugin.getAbilities().getAll())
|
||||
if (name.replace("-", "_").replace(" ", "_").equalsIgnoreCase(ability.getID()))
|
||||
return ability;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addModifier(String modifierPath, double defaultValue) {
|
||||
modifiers.put(modifierPath, defaultValue);
|
||||
}
|
||||
@ -102,13 +92,6 @@ public abstract class Ability {
|
||||
|
||||
public abstract void whenCast(CachedStats stats, AbilityResult ability, ItemAttackResult result);
|
||||
|
||||
/*
|
||||
* util methods for abilities
|
||||
*/
|
||||
protected Vector getTargetDirection(Player player, LivingEntity target) {
|
||||
return target == null ? player.getEyeLocation().getDirection() : target.getLocation().add(0, target.getHeight() / 2, 0).subtract(player.getLocation().add(0, 1.3, 0)).toVector().normalize();
|
||||
}
|
||||
|
||||
public enum CastingMode {
|
||||
|
||||
/*
|
||||
|
@ -0,0 +1,30 @@
|
||||
package net.Indyuce.mmoitems.api.ability;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class VectorAbilityResult extends AbilityResult {
|
||||
private final Vector target;
|
||||
|
||||
public VectorAbilityResult(AbilityData ability, Player caster, LivingEntity target) {
|
||||
super(ability);
|
||||
|
||||
this.target = getTargetDirection(caster, target);
|
||||
}
|
||||
|
||||
public Vector getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccessful() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Vector getTargetDirection(Player player, LivingEntity target) {
|
||||
return target == null ? player.getEyeLocation().getDirection() : target.getLocation().add(0, target.getHeight() / 2, 0).subtract(player.getLocation().add(0, 1.3, 0)).toVector().normalize();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user