forked from Upstream/mmocore
!Fixed an issue with ray traces
This commit is contained in:
parent
44b7676f17
commit
3c046682cc
@ -1,12 +1,11 @@
|
|||||||
package net.Indyuce.mmocore.api.skill;
|
package net.Indyuce.mmocore.api.skill;
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.util.RayTraceResult;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCoreUtils;
|
import net.Indyuce.mmocore.MMOCoreUtils;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.skill.Skill.SkillInfo;
|
import net.Indyuce.mmocore.api.skill.Skill.SkillInfo;
|
||||||
import net.mmogroup.mmolib.MMOLib;
|
|
||||||
import net.mmogroup.mmolib.api.MMORayTraceResult;
|
|
||||||
|
|
||||||
public class TargetSkillResult extends SkillResult {
|
public class TargetSkillResult extends SkillResult {
|
||||||
private LivingEntity target;
|
private LivingEntity target;
|
||||||
@ -15,11 +14,11 @@ public class TargetSkillResult extends SkillResult {
|
|||||||
super(data, skill);
|
super(data, skill);
|
||||||
|
|
||||||
if (isSuccessful()) {
|
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)
|
if (result == null)
|
||||||
abort(CancelReason.OTHER);
|
abort(CancelReason.OTHER);
|
||||||
else
|
else
|
||||||
target = (LivingEntity) result.getHit();
|
target = (LivingEntity) result.getHitEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user