!Fixed an issue with ray traces

This commit is contained in:
Indyuce 2019-12-24 00:53:33 +01:00
parent 44b7676f17
commit 3c046682cc

View File

@ -1,12 +1,11 @@
package net.Indyuce.mmocore.api.skill;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.RayTraceResult;
import net.Indyuce.mmocore.MMOCoreUtils;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.skill.Skill.SkillInfo;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.MMORayTraceResult;
public class TargetSkillResult extends SkillResult {
private LivingEntity target;
@ -15,11 +14,11 @@ public class TargetSkillResult extends SkillResult {
super(data, skill);
if (isSuccessful()) {
MMORayTraceResult result = MMOLib.plugin.getVersion().getWrapper().rayTrace(data.getPlayer(), data.getPlayer().getEyeLocation().getDirection(), range, entity -> MMOCoreUtils.canTarget(data.getPlayer(), entity));
RayTraceResult result = data.getPlayer().getWorld().rayTraceEntities(data.getPlayer().getEyeLocation(), data.getPlayer().getEyeLocation().getDirection(), range, entity -> MMOCoreUtils.canTarget(data.getPlayer(), entity));
if (result == null)
abort(CancelReason.OTHER);
else
target = (LivingEntity) result.getHit();
target = (LivingEntity) result.getHitEntity();
}
}