Skip to content

Commit

Permalink
Use deprecated TippedArrow interface
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jun 5, 2020
1 parent fd14197 commit 2a1ce46
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package net.citizensnpcs.nms.v1_15_R1.entity.nonliving;

import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController;
import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_15_R1.CraftServer;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.TippedArrow;
import org.bukkit.util.Vector;

import net.citizensnpcs.api.event.NPCPushEvent;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController;
import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
Expand All @@ -26,8 +25,8 @@ public TippedArrowController() {
}

@Override
public Arrow getBukkitEntity() {
return (Arrow) super.getBukkitEntity();
public TippedArrow getBukkitEntity() {
return (TippedArrow) super.getBukkitEntity();
}

public static class EntityTippedArrowNPC extends EntityTippedArrow implements NPCHolder {
Expand Down Expand Up @@ -57,6 +56,19 @@ public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
}

@Override
public CraftEntity getBukkitEntity() {
if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) {
NMSImpl.setBukkitEntity(this, new TippedArrowNPC(this));
}
return super.getBukkitEntity();
}

@Override
public NPC getNPC() {
return npc;
}

@Override
public void h(double x, double y, double z) {
if (npc == null) {
Expand All @@ -79,19 +91,6 @@ public void h(double x, double y, double z) {
// cancelled.
}

@Override
public CraftEntity getBukkitEntity() {
if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) {
NMSImpl.setBukkitEntity(this, new TippedArrowNPC(this));
}
return super.getBukkitEntity();
}

@Override
public NPC getNPC() {
return npc;
}

@Override
public void tick() {
if (npc != null) {
Expand Down

0 comments on commit 2a1ce46

Please sign in to comment.