Search in sources :

Example 1 with EntityStatusMessage

use of net.glowstone.net.message.play.entity.EntityStatusMessage in project Glowstone by GlowstoneMC.

the class GlowEntity method playEffect.

@Override
public void playEffect(EntityEffect type) {
    if (type.getApplicable().isInstance(this)) {
        EntityStatusMessage message = new EntityStatusMessage(entityId, type);
        world.getRawPlayers().stream().filter(player -> player.canSeeEntity(this)).forEach(player -> player.getSession().send(message));
    }
}
Also used : Plugin(org.bukkit.plugin.Plugin) EntityEffect(org.bukkit.EntityEffect) EntityUnleashEvent(org.bukkit.event.entity.EntityUnleashEvent) StatusFlags(net.glowstone.entity.meta.MetadataIndex.StatusFlags) UuidUtils(net.glowstone.util.UuidUtils) Projectile(org.bukkit.entity.Projectile) BlockFace(org.bukkit.block.BlockFace) Player(org.bukkit.entity.Player) EntityMountEvent(org.spigotmc.event.entity.EntityMountEvent) EntityPortalExitEvent(org.bukkit.event.entity.EntityPortalExitEvent) Block(org.bukkit.block.Block) Location(org.bukkit.Location) EntityRotationMessage(net.glowstone.net.message.play.entity.EntityRotationMessage) EntityStatusMessage(net.glowstone.net.message.play.entity.EntityStatusMessage) World(org.bukkit.World) InteractEntityMessage(net.glowstone.net.message.play.player.InteractEntityMessage) Chunk(org.bukkit.Chunk) BoundingBox(net.glowstone.entity.physics.BoundingBox) GlowWorld(net.glowstone.GlowWorld) GlowItemFrame(net.glowstone.entity.objects.GlowItemFrame) Material(org.bukkit.Material) ReadWriteLock(java.util.concurrent.locks.ReadWriteLock) Position(net.glowstone.util.Position) DamageCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause) PersistentDataContainer(org.bukkit.persistence.PersistentDataContainer) PistonMoveReaction(org.bukkit.block.PistonMoveReaction) EntityMetadataMessage(net.glowstone.net.message.play.entity.EntityMetadataMessage) Entity(org.bukkit.entity.Entity) CreatureSpawnEvent(org.bukkit.event.entity.CreatureSpawnEvent) GlowChunk(net.glowstone.chunk.GlowChunk) Set(java.util.Set) UUID(java.util.UUID) EntityType(org.bukkit.entity.EntityType) LivingEntity(org.bukkit.entity.LivingEntity) ItemStack(org.bukkit.inventory.ItemStack) EntityTeleportMessage(net.glowstone.net.message.play.entity.EntityTeleportMessage) Objects(java.util.Objects) EntityBoundingBox(net.glowstone.entity.physics.EntityBoundingBox) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) MetadataIndex(net.glowstone.entity.meta.MetadataIndex) MetadataValue(org.bukkit.metadata.MetadataValue) Entry(net.glowstone.entity.meta.MetadataMap.Entry) VehicleExitEvent(org.bukkit.event.vehicle.VehicleExitEvent) Optional(java.util.Optional) NotNull(org.jetbrains.annotations.NotNull) PlayerInitialSpawnEvent(com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent) Setter(lombok.Setter) SetPassengerMessage(net.glowstone.net.message.play.entity.SetPassengerMessage) VehicleEnterEvent(org.bukkit.event.vehicle.VehicleEnterEvent) Getter(lombok.Getter) MetadataMap(net.glowstone.entity.meta.MetadataMap) Message(com.flowpowered.network.Message) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) ArrayList(java.util.ArrayList) EntityDismountEvent(org.spigotmc.event.entity.EntityDismountEvent) Lists(com.google.common.collect.Lists) Environment(org.bukkit.World.Environment) PermissionAttachment(org.bukkit.permissions.PermissionAttachment) ImmutableList(com.google.common.collect.ImmutableList) GlowLeashHitch(net.glowstone.entity.objects.GlowLeashHitch) Component(net.kyori.adventure.text.Component) Vehicle(org.bukkit.entity.Vehicle) GlowSession(net.glowstone.net.GlowSession) GlowServer(net.glowstone.GlowServer) LinkedList(java.util.LinkedList) TextMessage(net.glowstone.util.TextMessage) RelativeEntityPositionMessage(net.glowstone.net.message.play.entity.RelativeEntityPositionMessage) EntityDamageEvent(org.bukkit.event.entity.EntityDamageEvent) MetadataStore(org.bukkit.metadata.MetadataStore) PlayerSpawnLocationEvent(org.spigotmc.event.player.PlayerSpawnLocationEvent) GlowPainting(net.glowstone.entity.objects.GlowPainting) EntityPortalEvent(org.bukkit.event.entity.EntityPortalEvent) TeleportCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause) UnleashReason(org.bukkit.event.entity.EntityUnleashEvent.UnleashReason) EventFactory(net.glowstone.EventFactory) EntityTeleportEvent(org.bukkit.event.entity.EntityTeleportEvent) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) PermissionAttachmentInfo(org.bukkit.permissions.PermissionAttachmentInfo) EntityVelocityMessage(net.glowstone.net.message.play.entity.EntityVelocityMessage) Permission(org.bukkit.permissions.Permission) Vector(org.bukkit.util.Vector) AttachEntityMessage(net.glowstone.net.message.play.entity.AttachEntityMessage) Pose(org.bukkit.entity.Pose) Preconditions(com.google.common.base.Preconditions) RelativeEntityPositionRotationMessage(net.glowstone.net.message.play.entity.RelativeEntityPositionRotationMessage) EntityPortalEnterEvent(org.bukkit.event.entity.EntityPortalEnterEvent) MetadataStoreBase(org.bukkit.metadata.MetadataStoreBase) Collections(java.util.Collections) ProjectileHitEvent(org.bukkit.event.entity.ProjectileHitEvent) EntityStatusMessage(net.glowstone.net.message.play.entity.EntityStatusMessage)

Example 2 with EntityStatusMessage

use of net.glowstone.net.message.play.entity.EntityStatusMessage in project Glowstone by GlowstoneMC.

the class GlowEntity method playEffectKnownAndSelf.

public void playEffectKnownAndSelf(EntityEffect type) {
    if (type.getApplicable().isInstance(this)) {
        EntityStatusMessage message = new EntityStatusMessage(entityId, type);
        if (this instanceof GlowPlayer) {
            ((GlowPlayer) this).getSession().send(message);
        }
        world.getRawPlayers().stream().filter(player -> player.canSeeEntity(this)).forEach(player -> player.getSession().send(message));
    }
}
Also used : Plugin(org.bukkit.plugin.Plugin) EntityEffect(org.bukkit.EntityEffect) EntityUnleashEvent(org.bukkit.event.entity.EntityUnleashEvent) StatusFlags(net.glowstone.entity.meta.MetadataIndex.StatusFlags) UuidUtils(net.glowstone.util.UuidUtils) Projectile(org.bukkit.entity.Projectile) BlockFace(org.bukkit.block.BlockFace) Player(org.bukkit.entity.Player) EntityMountEvent(org.spigotmc.event.entity.EntityMountEvent) EntityPortalExitEvent(org.bukkit.event.entity.EntityPortalExitEvent) Block(org.bukkit.block.Block) Location(org.bukkit.Location) EntityRotationMessage(net.glowstone.net.message.play.entity.EntityRotationMessage) EntityStatusMessage(net.glowstone.net.message.play.entity.EntityStatusMessage) World(org.bukkit.World) InteractEntityMessage(net.glowstone.net.message.play.player.InteractEntityMessage) Chunk(org.bukkit.Chunk) BoundingBox(net.glowstone.entity.physics.BoundingBox) GlowWorld(net.glowstone.GlowWorld) GlowItemFrame(net.glowstone.entity.objects.GlowItemFrame) Material(org.bukkit.Material) ReadWriteLock(java.util.concurrent.locks.ReadWriteLock) Position(net.glowstone.util.Position) DamageCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause) PersistentDataContainer(org.bukkit.persistence.PersistentDataContainer) PistonMoveReaction(org.bukkit.block.PistonMoveReaction) EntityMetadataMessage(net.glowstone.net.message.play.entity.EntityMetadataMessage) Entity(org.bukkit.entity.Entity) CreatureSpawnEvent(org.bukkit.event.entity.CreatureSpawnEvent) GlowChunk(net.glowstone.chunk.GlowChunk) Set(java.util.Set) UUID(java.util.UUID) EntityType(org.bukkit.entity.EntityType) LivingEntity(org.bukkit.entity.LivingEntity) ItemStack(org.bukkit.inventory.ItemStack) EntityTeleportMessage(net.glowstone.net.message.play.entity.EntityTeleportMessage) Objects(java.util.Objects) EntityBoundingBox(net.glowstone.entity.physics.EntityBoundingBox) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) MetadataIndex(net.glowstone.entity.meta.MetadataIndex) MetadataValue(org.bukkit.metadata.MetadataValue) Entry(net.glowstone.entity.meta.MetadataMap.Entry) VehicleExitEvent(org.bukkit.event.vehicle.VehicleExitEvent) Optional(java.util.Optional) NotNull(org.jetbrains.annotations.NotNull) PlayerInitialSpawnEvent(com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent) Setter(lombok.Setter) SetPassengerMessage(net.glowstone.net.message.play.entity.SetPassengerMessage) VehicleEnterEvent(org.bukkit.event.vehicle.VehicleEnterEvent) Getter(lombok.Getter) MetadataMap(net.glowstone.entity.meta.MetadataMap) Message(com.flowpowered.network.Message) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) ArrayList(java.util.ArrayList) EntityDismountEvent(org.spigotmc.event.entity.EntityDismountEvent) Lists(com.google.common.collect.Lists) Environment(org.bukkit.World.Environment) PermissionAttachment(org.bukkit.permissions.PermissionAttachment) ImmutableList(com.google.common.collect.ImmutableList) GlowLeashHitch(net.glowstone.entity.objects.GlowLeashHitch) Component(net.kyori.adventure.text.Component) Vehicle(org.bukkit.entity.Vehicle) GlowSession(net.glowstone.net.GlowSession) GlowServer(net.glowstone.GlowServer) LinkedList(java.util.LinkedList) TextMessage(net.glowstone.util.TextMessage) RelativeEntityPositionMessage(net.glowstone.net.message.play.entity.RelativeEntityPositionMessage) EntityDamageEvent(org.bukkit.event.entity.EntityDamageEvent) MetadataStore(org.bukkit.metadata.MetadataStore) PlayerSpawnLocationEvent(org.spigotmc.event.player.PlayerSpawnLocationEvent) GlowPainting(net.glowstone.entity.objects.GlowPainting) EntityPortalEvent(org.bukkit.event.entity.EntityPortalEvent) TeleportCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause) UnleashReason(org.bukkit.event.entity.EntityUnleashEvent.UnleashReason) EventFactory(net.glowstone.EventFactory) EntityTeleportEvent(org.bukkit.event.entity.EntityTeleportEvent) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) PermissionAttachmentInfo(org.bukkit.permissions.PermissionAttachmentInfo) EntityVelocityMessage(net.glowstone.net.message.play.entity.EntityVelocityMessage) Permission(org.bukkit.permissions.Permission) Vector(org.bukkit.util.Vector) AttachEntityMessage(net.glowstone.net.message.play.entity.AttachEntityMessage) Pose(org.bukkit.entity.Pose) Preconditions(com.google.common.base.Preconditions) RelativeEntityPositionRotationMessage(net.glowstone.net.message.play.entity.RelativeEntityPositionRotationMessage) EntityPortalEnterEvent(org.bukkit.event.entity.EntityPortalEnterEvent) MetadataStoreBase(org.bukkit.metadata.MetadataStoreBase) Collections(java.util.Collections) ProjectileHitEvent(org.bukkit.event.entity.ProjectileHitEvent) EntityStatusMessage(net.glowstone.net.message.play.entity.EntityStatusMessage)

Aggregations

PlayerInitialSpawnEvent (com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent)2 Message (com.flowpowered.network.Message)2 Preconditions (com.google.common.base.Preconditions)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)2 ImmutableList (com.google.common.collect.ImmutableList)2 Lists (com.google.common.collect.Lists)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Set (java.util.Set)2 UUID (java.util.UUID)2 ReadWriteLock (java.util.concurrent.locks.ReadWriteLock)2 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)2 Getter (lombok.Getter)2 Setter (lombok.Setter)2 EventFactory (net.glowstone.EventFactory)2 GlowServer (net.glowstone.GlowServer)2