Search in sources :

Example 11 with SkinnableEntity

use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.

the class NMSImpl method sendTabListRemove.

@Override
public void sendTabListRemove(Player recipient, Collection<? extends SkinnableEntity> skinnableNPCs) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(skinnableNPCs);
    EntityPlayer[] entities = new EntityPlayer[skinnableNPCs.size()];
    int i = 0;
    for (SkinnableEntity skinnable : skinnableNPCs) {
        entities[i] = (EntityPlayer) skinnable;
        i++;
    }
    NMSImpl.sendPacket(recipient, new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entities));
}
Also used : SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) PacketPlayOutPlayerInfo(net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 12 with SkinnableEntity

use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.

the class NMSImpl method sendTabListRemove.

@Override
public void sendTabListRemove(Player recipient, Collection<? extends SkinnableEntity> skinnableNPCs) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(skinnableNPCs);
    EntityPlayer[] entities = new EntityPlayer[skinnableNPCs.size()];
    int i = 0;
    for (SkinnableEntity skinnable : skinnableNPCs) {
        entities[i] = (EntityPlayer) skinnable;
        i++;
    }
    NMSImpl.sendPacket(recipient, new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entities));
}
Also used : SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer) PacketPlayOutPlayerInfo(net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 13 with SkinnableEntity

use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.

the class PlayerlistTrackerEntry method updatePlayer.

@Override
public void updatePlayer(final EntityPlayer entityplayer) {
    // prevent updates to NPC "viewers"
    if (entityplayer instanceof EntityHumanNPC)
        return;
    Entity tracker = getTracker(this);
    if (entityplayer != tracker && c(entityplayer)) {
        if (!this.trackedPlayers.contains(entityplayer) && ((entityplayer.x().getPlayerChunkMap().a(entityplayer, tracker.ab, tracker.ad)) || (tracker.attachedToPlayer))) {
            if ((tracker instanceof SkinnableEntity)) {
                SkinnableEntity skinnable = (SkinnableEntity) tracker;
                Player player = skinnable.getBukkitEntity();
                if (!entityplayer.getBukkitEntity().canSee(player))
                    return;
                skinnable.getSkinTracker().updateViewer(entityplayer.getBukkitEntity());
            }
        }
    }
    super.updatePlayer(entityplayer);
}
Also used : Entity(net.minecraft.server.v1_12_R1.Entity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer) Player(org.bukkit.entity.Player) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityHumanNPC(net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)

Example 14 with SkinnableEntity

use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.

the class PlayerlistTrackerEntry method updatePlayer.

@Override
public void updatePlayer(final EntityPlayer entityplayer) {
    // prevent updates to NPC "viewers"
    if (entityplayer instanceof EntityHumanNPC)
        return;
    Entity tracker = getTracker(this);
    if (entityplayer != tracker && c(entityplayer)) {
        if (!this.trackedPlayers.contains(entityplayer) && ((entityplayer.x().getPlayerChunkMap().a(entityplayer, tracker.ab, tracker.ad)) || (tracker.attachedToPlayer))) {
            if ((tracker instanceof SkinnableEntity)) {
                SkinnableEntity skinnable = (SkinnableEntity) tracker;
                Player player = skinnable.getBukkitEntity();
                if (!entityplayer.getBukkitEntity().canSee(player))
                    return;
                skinnable.getSkinTracker().updateViewer(entityplayer.getBukkitEntity());
            }
        }
    }
    super.updatePlayer(entityplayer);
}
Also used : Entity(net.minecraft.server.v1_11_R1.Entity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) Player(org.bukkit.entity.Player) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityHumanNPC(net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)

Example 15 with SkinnableEntity

use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.

the class HumanController method remove.

@Override
public void remove() {
    Player entity = getBukkitEntity();
    if (entity != null) {
        NMS.removeFromWorld(entity);
        SkinnableEntity npc = entity instanceof SkinnableEntity ? (SkinnableEntity) entity : null;
        npc.getSkinTracker().onRemoveNPC();
    }
    super.remove();
}
Also used : Player(org.bukkit.entity.Player) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity)

Aggregations

SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)15 Player (org.bukkit.entity.Player)9 EntityPlayer (net.minecraft.server.v1_10_R1.EntityPlayer)2 EntityPlayer (net.minecraft.server.v1_11_R1.EntityPlayer)2 EntityPlayer (net.minecraft.server.v1_12_R1.EntityPlayer)2 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)2 NPCNeedsRespawnEvent (net.citizensnpcs.NPCNeedsRespawnEvent)1 Command (net.citizensnpcs.api.command.Command)1 Requirements (net.citizensnpcs.api.command.Requirements)1 CommandException (net.citizensnpcs.api.command.exception.CommandException)1 ServerCommandException (net.citizensnpcs.api.command.exception.ServerCommandException)1 NPCSpawnEvent (net.citizensnpcs.api.event.NPCSpawnEvent)1 Trait (net.citizensnpcs.api.trait.Trait)1 Spawned (net.citizensnpcs.api.trait.trait.Spawned)1 EntityHumanNPC (net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC)1 CurrentLocation (net.citizensnpcs.trait.CurrentLocation)1 Entity (net.minecraft.server.v1_10_R1.Entity)1