mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-26 11:07:59 +01:00
Fix compatibility with ProtocolLib
This commit is contained in:
parent
599d5dd35d
commit
f9308391ba
@ -187,6 +187,7 @@ public class EventListen implements Listener {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
NPC npc = npcRegistry.getNPC(event.getEntity());
|
||||
|
||||
if (npc == null) {
|
||||
if (event instanceof EntityDamageByEntityEvent) {
|
||||
npc = npcRegistry.getNPC(((EntityDamageByEntityEvent) event).getDamager());
|
||||
|
@ -273,6 +273,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
super.m();
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
boolean navigating = npc.getNavigator().isNavigating();
|
||||
updatePackets(navigating);
|
||||
if (gravity && !navigating && getBukkitEntity() != null
|
||||
|
@ -70,8 +70,9 @@ public class GhastController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,8 +28,9 @@ public class Util {
|
||||
}
|
||||
|
||||
public static void callCollisionEvent(NPC npc, Entity entity) {
|
||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length > 0)
|
||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
||||
Bukkit.getPluginManager().callEvent(new NPCCollisionEvent(npc, entity));
|
||||
}
|
||||
}
|
||||
|
||||
public static NPCPushEvent callPushEvent(NPC npc, Vector vector) {
|
||||
|
@ -12,11 +12,8 @@ import net.minecraft.server.v1_9_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R1.EntityTrackerEntry;
|
||||
|
||||
public class PlayerlistTrackerEntry extends EntityTrackerEntry {
|
||||
private final Entity tracker;
|
||||
|
||||
public PlayerlistTrackerEntry(Entity entity, int i, int j, int k, boolean flag) {
|
||||
super(entity, i, j, k, flag);
|
||||
this.tracker = entity;
|
||||
}
|
||||
|
||||
public PlayerlistTrackerEntry(EntityTrackerEntry entry) {
|
||||
@ -28,14 +25,14 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
|
||||
// prevent updates to NPC "viewers"
|
||||
if (entityplayer instanceof EntityHumanNPC)
|
||||
return;
|
||||
|
||||
if (entityplayer != this.tracker && c(entityplayer)) {
|
||||
Entity tracker = getTracker(this);
|
||||
if (entityplayer != tracker && c(entityplayer)) {
|
||||
if (!this.trackedPlayers.contains(entityplayer)
|
||||
&& ((entityplayer.x().getPlayerChunkMap().a(entityplayer, this.tracker.ab, this.tracker.ad))
|
||||
|| (this.tracker.attachedToPlayer))) {
|
||||
if ((this.tracker instanceof SkinnableEntity)) {
|
||||
&& ((entityplayer.x().getPlayerChunkMap().a(entityplayer, tracker.ab, tracker.ad))
|
||||
|| (tracker.attachedToPlayer))) {
|
||||
if ((tracker instanceof SkinnableEntity)) {
|
||||
|
||||
SkinnableEntity skinnable = (SkinnableEntity) this.tracker;
|
||||
SkinnableEntity skinnable = (SkinnableEntity) tracker;
|
||||
|
||||
Player player = skinnable.getBukkitEntity();
|
||||
if (!entityplayer.getBukkitEntity().canSee(player))
|
||||
|
Loading…
Reference in New Issue
Block a user