mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-12-28 05:37:44 +01:00
Fixed a 1.12 compatibility issue with ray traces
This commit is contained in:
parent
df52b2c679
commit
8417ca60ca
@ -1,11 +1,12 @@
|
||||
package net.Indyuce.mmocore.api.skill;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.skill.Skill.SkillInfo;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.MMORayTraceResult;
|
||||
|
||||
public class TargetSkillResult extends SkillResult {
|
||||
private LivingEntity target;
|
||||
@ -14,11 +15,11 @@ public class TargetSkillResult extends SkillResult {
|
||||
super(data, skill);
|
||||
|
||||
if (isSuccessful()) {
|
||||
RayTraceResult result = data.getPlayer().getWorld().rayTraceEntities(data.getPlayer().getEyeLocation(), data.getPlayer().getEyeLocation().getDirection(), range, entity -> MMOCoreUtils.canTarget(data.getPlayer(), entity));
|
||||
if (result == null)
|
||||
MMORayTraceResult result = MMOLib.plugin.getVersion().getWrapper().rayTrace(data.getPlayer(), range, entity -> MMOCoreUtils.canTarget(data.getPlayer(), entity));
|
||||
if (!result.hasHit())
|
||||
abort(CancelReason.OTHER);
|
||||
else
|
||||
target = (LivingEntity) result.getHitEntity();
|
||||
target = (LivingEntity) result.getHit();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user