Class EntityMock

java.lang.Object
org.bukkit.command.CommandSender.Spigot
org.bukkit.entity.Entity.Spigot
be.seeseemelk.mockbukkit.entity.EntityMock
All Implemented Interfaces:
MessageTarget, net.kyori.adventure.audience.Audience, net.kyori.adventure.pointer.Pointered, net.kyori.adventure.sound.Sound.Emitter, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, org.bukkit.command.CommandSender, org.bukkit.entity.Entity, org.bukkit.metadata.Metadatable, org.bukkit.Nameable, org.bukkit.permissions.Permissible, org.bukkit.permissions.ServerOperator, org.bukkit.persistence.PersistentDataHolder
Direct Known Subclasses:
AbstractProjectileMock, ExperienceOrbMock, HangingMock, ItemEntityMock, LivingEntityMock, SimpleEntityMock, VehicleMock

public abstract class EntityMock extends org.bukkit.entity.Entity.Spigot implements org.bukkit.entity.Entity, MessageTarget
  • Constructor Details

    • EntityMock

      protected EntityMock(@NotNull @NotNull ServerMock server, @NotNull @NotNull UUID uuid)
  • Method Details

    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • assertLocation

      public void assertLocation(@NotNull @NotNull org.bukkit.Location expectedLocation, double maximumDistance)
      Assert that the actual location of the player is within a certain distance to a given location.
      Parameters:
      expectedLocation - The location the player should be at.
      maximumDistance - The distance the player may maximumly be separated from the expected location.
    • assertTeleported

      public void assertTeleported(@NotNull @NotNull org.bukkit.Location expectedLocation, double maximumDistance)
      Assert that the player teleported to a certain location within a certain distance to a given location. Also clears the teleported flag.
      Parameters:
      expectedLocation - The location the player should be at.
      maximumDistance - The distance the player may maximumly be separated from the expected location.
    • assertNotTeleported

      public void assertNotTeleported()
      Assert that the player hasn't teleported. Also clears the teleported flag.
    • hasTeleported

      public boolean hasTeleported()
      Checks if the player has been teleported since the last assert or clearTeleported().
      Returns:
      true if the player has been teleported, false if he hasn't been teleported.
    • clearTeleported

      public void clearTeleported()
      Clears the teleported flag.
    • getTeleportCause

      public org.bukkit.event.player.PlayerTeleportEvent.TeleportCause getTeleportCause()
      Get the cause of the last teleport.
      Returns:
      The cause of the last teleport.
    • getUniqueId

      @NotNull public @NotNull UUID getUniqueId()
      Specified by:
      getUniqueId in interface org.bukkit.entity.Entity
    • getLocation

      @NotNull public @NotNull org.bukkit.Location getLocation()
      Specified by:
      getLocation in interface org.bukkit.entity.Entity
    • getTrackedPlayers

      @NotNull public @NotNull Set<org.bukkit.entity.Player> getTrackedPlayers()
      Specified by:
      getTrackedPlayers in interface org.bukkit.entity.Entity
    • getLocation

      public org.bukkit.Location getLocation(@Nullable @Nullable org.bukkit.Location loc)
      Specified by:
      getLocation in interface org.bukkit.entity.Entity
    • setLocation

      public void setLocation(@NotNull @NotNull org.bukkit.Location location)
      Sets the location of the entity. Note that this will not fire a teleport event.
      Parameters:
      location - The new location of the entity.
    • getWorld

      @NotNull public @NotNull org.bukkit.World getWorld()
      Specified by:
      getWorld in interface org.bukkit.entity.Entity
    • setMetadata

      public void setMetadata(@NotNull @NotNull String metadataKey, @NotNull @NotNull org.bukkit.metadata.MetadataValue newMetadataValue)
      Specified by:
      setMetadata in interface org.bukkit.metadata.Metadatable
    • getMetadata

      @NotNull public @NotNull List<org.bukkit.metadata.MetadataValue> getMetadata(@NotNull @NotNull String metadataKey)
      Specified by:
      getMetadata in interface org.bukkit.metadata.Metadatable
    • hasMetadata

      public boolean hasMetadata(@NotNull @NotNull String metadataKey)
      Specified by:
      hasMetadata in interface org.bukkit.metadata.Metadatable
    • removeMetadata

      public void removeMetadata(@NotNull @NotNull String metadataKey, @NotNull @NotNull org.bukkit.plugin.Plugin owningPlugin)
      Specified by:
      removeMetadata in interface org.bukkit.metadata.Metadatable
    • getPersistentDataContainer

      @NotNull public @NotNull org.bukkit.persistence.PersistentDataContainer getPersistentDataContainer()
      Specified by:
      getPersistentDataContainer in interface org.bukkit.persistence.PersistentDataHolder
    • teleport

      public boolean teleport(@NotNull @NotNull org.bukkit.Location location)
      Specified by:
      teleport in interface org.bukkit.entity.Entity
    • teleport

      public boolean teleport(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
      Specified by:
      teleport in interface org.bukkit.entity.Entity
    • teleportWithoutEvent

      protected void teleportWithoutEvent(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
    • teleport

      public boolean teleport(@NotNull @NotNull org.bukkit.entity.Entity destination)
      Specified by:
      teleport in interface org.bukkit.entity.Entity
    • teleport

      public boolean teleport(@NotNull @NotNull org.bukkit.entity.Entity destination, @NotNull @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
      Specified by:
      teleport in interface org.bukkit.entity.Entity
    • isOp

      public boolean isOp()
      Specified by:
      isOp in interface org.bukkit.permissions.ServerOperator
    • setOp

      public void setOp(boolean isOperator)
      Specified by:
      setOp in interface org.bukkit.permissions.ServerOperator
    • getName

      @NotNull public @NotNull String getName()
      Specified by:
      getName in interface org.bukkit.command.CommandSender
    • getScoreboardEntry

      @NotNull public @NotNull String getScoreboardEntry()
      Gets the scoreboard entry for this entity.
      Returns:
      The scoreboard entry.
    • setName

      public void setName(@NotNull @NotNull String name)
      Sets the name of this entity.
      Parameters:
      name - The new name of the entity.
    • sendMessage

      public void sendMessage(@NotNull @NotNull String message)
      Specified by:
      sendMessage in interface org.bukkit.command.CommandSender
    • sendMessage

      public void sendMessage(String... messages)
      Specified by:
      sendMessage in interface org.bukkit.command.CommandSender
    • sendMessage

      public void sendMessage(@Nullable @Nullable UUID sender, @NotNull @NotNull String message)
      Specified by:
      sendMessage in interface org.bukkit.command.CommandSender
    • sendMessage

      public void sendMessage(UUID sender, String @NotNull ... messages)
      Specified by:
      sendMessage in interface org.bukkit.command.CommandSender
    • sendMessage

      public void sendMessage(@NotNull @NotNull net.kyori.adventure.identity.Identity source, @NotNull @NotNull net.kyori.adventure.text.Component message, @NotNull @NotNull net.kyori.adventure.audience.MessageType type)
      Specified by:
      sendMessage in interface net.kyori.adventure.audience.Audience
      Specified by:
      sendMessage in interface org.bukkit.command.CommandSender
    • nextComponentMessage

      @Nullable public @Nullable net.kyori.adventure.text.Component nextComponentMessage()
      Description copied from interface: MessageTarget
      Returns the next message that was sent to the target.
      Specified by:
      nextComponentMessage in interface MessageTarget
      Returns:
      The next message sent to the target.
    • isPermissionSet

      public boolean isPermissionSet(@NotNull @NotNull String name)
      Specified by:
      isPermissionSet in interface org.bukkit.permissions.Permissible
    • isPermissionSet

      public boolean isPermissionSet(@NotNull @NotNull org.bukkit.permissions.Permission perm)
      Specified by:
      isPermissionSet in interface org.bukkit.permissions.Permissible
    • hasPermission

      public boolean hasPermission(@NotNull @NotNull String name)
      Specified by:
      hasPermission in interface org.bukkit.permissions.Permissible
    • hasPermission

      public boolean hasPermission(@NotNull @NotNull org.bukkit.permissions.Permission perm)
      Specified by:
      hasPermission in interface org.bukkit.permissions.Permissible
    • addAttachment

      @NotNull public @NotNull org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String name, boolean value)
      Specified by:
      addAttachment in interface org.bukkit.permissions.Permissible
    • addAttachment

      @NotNull public @NotNull org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
      Specified by:
      addAttachment in interface org.bukkit.permissions.Permissible
    • addAttachment

      public org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String name, boolean value, int ticks)
      Specified by:
      addAttachment in interface org.bukkit.permissions.Permissible
    • addAttachment

      public org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, int ticks)
      Specified by:
      addAttachment in interface org.bukkit.permissions.Permissible
    • removeAttachment

      public void removeAttachment(@NotNull @NotNull org.bukkit.permissions.PermissionAttachment attachment)
      Specified by:
      removeAttachment in interface org.bukkit.permissions.Permissible
    • recalculatePermissions

      public void recalculatePermissions()
      Specified by:
      recalculatePermissions in interface org.bukkit.permissions.Permissible
    • getEffectivePermissions

      @NotNull public @NotNull Set<org.bukkit.permissions.PermissionAttachmentInfo> getEffectivePermissions()
      Specified by:
      getEffectivePermissions in interface org.bukkit.permissions.Permissible
    • customName

      @Nullable public @Nullable net.kyori.adventure.text.Component customName()
      Specified by:
      customName in interface org.bukkit.Nameable
    • customName

      public void customName(@Nullable @Nullable net.kyori.adventure.text.Component customName)
      Specified by:
      customName in interface org.bukkit.Nameable
    • getCustomName

      public String getCustomName()
      Specified by:
      getCustomName in interface org.bukkit.Nameable
    • setCustomName

      public void setCustomName(@Nullable @Nullable String name)
      Specified by:
      setCustomName in interface org.bukkit.Nameable
    • setVelocity

      public void setVelocity(@NotNull @NotNull org.bukkit.util.Vector velocity)
      Specified by:
      setVelocity in interface org.bukkit.entity.Entity
    • getVelocity

      @NotNull public @NotNull org.bukkit.util.Vector getVelocity()
      Specified by:
      getVelocity in interface org.bukkit.entity.Entity
    • getHeight

      public double getHeight()
      Specified by:
      getHeight in interface org.bukkit.entity.Entity
    • getWidth

      public double getWidth()
      Specified by:
      getWidth in interface org.bukkit.entity.Entity
    • isOnGround

      public boolean isOnGround()
      Specified by:
      isOnGround in interface org.bukkit.entity.Entity
    • getNearbyEntities

      @NotNull public @NotNull List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z)
      Specified by:
      getNearbyEntities in interface org.bukkit.entity.Entity
    • getEntityId

      public int getEntityId()
      Specified by:
      getEntityId in interface org.bukkit.entity.Entity
    • getFireTicks

      public int getFireTicks()
      Specified by:
      getFireTicks in interface org.bukkit.entity.Entity
    • getMaxFireTicks

      public int getMaxFireTicks()
      Specified by:
      getMaxFireTicks in interface org.bukkit.entity.Entity
    • setFireTicks

      public void setFireTicks(int ticks)
      Specified by:
      setFireTicks in interface org.bukkit.entity.Entity
    • setVisualFire

      public void setVisualFire(boolean fire)
      Specified by:
      setVisualFire in interface org.bukkit.entity.Entity
    • isVisualFire

      public boolean isVisualFire()
      Specified by:
      isVisualFire in interface org.bukkit.entity.Entity
    • setFreezeTicks

      public void setFreezeTicks(int ticks)
      Specified by:
      setFreezeTicks in interface org.bukkit.entity.Entity
    • isFrozen

      public boolean isFrozen()
      Specified by:
      isFrozen in interface org.bukkit.entity.Entity
    • isFreezeTickingLocked

      public boolean isFreezeTickingLocked()
      Specified by:
      isFreezeTickingLocked in interface org.bukkit.entity.Entity
    • lockFreezeTicks

      public void lockFreezeTicks(boolean locked)
      Specified by:
      lockFreezeTicks in interface org.bukkit.entity.Entity
    • getFreezeTicks

      public int getFreezeTicks()
      Specified by:
      getFreezeTicks in interface org.bukkit.entity.Entity
    • getMaxFreezeTicks

      public int getMaxFreezeTicks()
      Specified by:
      getMaxFreezeTicks in interface org.bukkit.entity.Entity
    • remove

      public void remove()
      Specified by:
      remove in interface org.bukkit.entity.Entity
    • isDead

      public boolean isDead()
      Specified by:
      isDead in interface org.bukkit.entity.Entity
    • isValid

      public boolean isValid()
      Specified by:
      isValid in interface org.bukkit.entity.Entity
    • getServer

      @NotNull public @NotNull ServerMock getServer()
      Specified by:
      getServer in interface org.bukkit.command.CommandSender
      Specified by:
      getServer in interface org.bukkit.entity.Entity
    • getPassenger

      @Deprecated public org.bukkit.entity.Entity getPassenger()
      Deprecated.
      Specified by:
      getPassenger in interface org.bukkit.entity.Entity
    • setPassenger

      @Deprecated public boolean setPassenger(@NotNull @NotNull org.bukkit.entity.Entity passenger)
      Deprecated.
      Specified by:
      setPassenger in interface org.bukkit.entity.Entity
    • getPassengers

      @NotNull public @NotNull List<org.bukkit.entity.Entity> getPassengers()
      Specified by:
      getPassengers in interface org.bukkit.entity.Entity
    • addPassenger

      public boolean addPassenger(@NotNull @NotNull org.bukkit.entity.Entity passenger)
      Specified by:
      addPassenger in interface org.bukkit.entity.Entity
    • removePassenger

      public boolean removePassenger(@NotNull @NotNull org.bukkit.entity.Entity passenger)
      Specified by:
      removePassenger in interface org.bukkit.entity.Entity
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface org.bukkit.entity.Entity
    • eject

      public boolean eject()
      Specified by:
      eject in interface org.bukkit.entity.Entity
    • getFallDistance

      public float getFallDistance()
      Specified by:
      getFallDistance in interface org.bukkit.entity.Entity
    • setFallDistance

      public void setFallDistance(float distance)
      Specified by:
      setFallDistance in interface org.bukkit.entity.Entity
    • setLastDamageCause

      public void setLastDamageCause(@Nullable @Nullable org.bukkit.event.entity.EntityDamageEvent event)
      Specified by:
      setLastDamageCause in interface org.bukkit.entity.Entity
    • getLastDamageCause

      @Nullable public @Nullable org.bukkit.event.entity.EntityDamageEvent getLastDamageCause()
      Specified by:
      getLastDamageCause in interface org.bukkit.entity.Entity
    • getTicksLived

      public int getTicksLived()
      Specified by:
      getTicksLived in interface org.bukkit.entity.Entity
    • setTicksLived

      public void setTicksLived(int value)
      Specified by:
      setTicksLived in interface org.bukkit.entity.Entity
    • playEffect

      public void playEffect(@NotNull @NotNull org.bukkit.EntityEffect type)
      Specified by:
      playEffect in interface org.bukkit.entity.Entity
    • getType

      @NotNull public @NotNull org.bukkit.entity.EntityType getType()
      Specified by:
      getType in interface org.bukkit.entity.Entity
    • isInsideVehicle

      public boolean isInsideVehicle()
      Specified by:
      isInsideVehicle in interface org.bukkit.entity.Entity
    • leaveVehicle

      public boolean leaveVehicle()
      Specified by:
      leaveVehicle in interface org.bukkit.entity.Entity
    • getVehicle

      public org.bukkit.entity.Entity getVehicle()
      Specified by:
      getVehicle in interface org.bukkit.entity.Entity
    • setCustomNameVisible

      public void setCustomNameVisible(boolean flag)
      Specified by:
      setCustomNameVisible in interface org.bukkit.entity.Entity
    • isCustomNameVisible

      public boolean isCustomNameVisible()
      Specified by:
      isCustomNameVisible in interface org.bukkit.entity.Entity
    • setGlowing

      public void setGlowing(boolean flag)
      Specified by:
      setGlowing in interface org.bukkit.entity.Entity
    • isGlowing

      public boolean isGlowing()
      Specified by:
      isGlowing in interface org.bukkit.entity.Entity
    • setInvulnerable

      public void setInvulnerable(boolean flag)
      Specified by:
      setInvulnerable in interface org.bukkit.entity.Entity
    • isInvulnerable

      public boolean isInvulnerable()
      Specified by:
      isInvulnerable in interface org.bukkit.entity.Entity
    • isSilent

      public boolean isSilent()
      Specified by:
      isSilent in interface org.bukkit.entity.Entity
    • setSilent

      public void setSilent(boolean flag)
      Specified by:
      setSilent in interface org.bukkit.entity.Entity
    • hasGravity

      public boolean hasGravity()
      Specified by:
      hasGravity in interface org.bukkit.entity.Entity
    • setGravity

      public void setGravity(boolean gravity)
      Specified by:
      setGravity in interface org.bukkit.entity.Entity
    • getPortalCooldown

      public int getPortalCooldown()
      Specified by:
      getPortalCooldown in interface org.bukkit.entity.Entity
    • setPortalCooldown

      public void setPortalCooldown(int cooldown)
      Specified by:
      setPortalCooldown in interface org.bukkit.entity.Entity
    • getScoreboardTags

      @NotNull public @NotNull Set<String> getScoreboardTags()
      Specified by:
      getScoreboardTags in interface org.bukkit.entity.Entity
    • addScoreboardTag

      public boolean addScoreboardTag(@NotNull @NotNull String tag)
      Specified by:
      addScoreboardTag in interface org.bukkit.entity.Entity
    • removeScoreboardTag

      public boolean removeScoreboardTag(@NotNull @NotNull String tag)
      Specified by:
      removeScoreboardTag in interface org.bukkit.entity.Entity
    • getPistonMoveReaction

      @NotNull public @NotNull org.bukkit.block.PistonMoveReaction getPistonMoveReaction()
      Specified by:
      getPistonMoveReaction in interface org.bukkit.entity.Entity
    • setRotation

      public void setRotation(float yaw, float pitch)
      Specified by:
      setRotation in interface org.bukkit.entity.Entity
    • teleport

      public boolean teleport(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause, boolean ignorePassengers, boolean dismount)
      Specified by:
      teleport in interface org.bukkit.entity.Entity
    • getBoundingBox

      @NotNull public @NotNull org.bukkit.util.BoundingBox getBoundingBox()
      Specified by:
      getBoundingBox in interface org.bukkit.entity.Entity
    • isPersistent

      public boolean isPersistent()
      Specified by:
      isPersistent in interface org.bukkit.entity.Entity
    • setPersistent

      public void setPersistent(boolean persistent)
      Specified by:
      setPersistent in interface org.bukkit.entity.Entity
    • getFacing

      @NotNull public @NotNull org.bukkit.block.BlockFace getFacing()
      Specified by:
      getFacing in interface org.bukkit.entity.Entity
    • getPose

      @NotNull public @NotNull org.bukkit.entity.Pose getPose()
      Specified by:
      getPose in interface org.bukkit.entity.Entity
    • isInWater

      public boolean isInWater()
      Specified by:
      isInWater in interface org.bukkit.entity.Entity
    • getSpawnCategory

      @NotNull public @NotNull org.bukkit.entity.SpawnCategory getSpawnCategory()
      Specified by:
      getSpawnCategory in interface org.bukkit.entity.Entity
    • spigot

      public @NotNull org.bukkit.entity.Entity.Spigot spigot()
      Specified by:
      spigot in interface org.bukkit.command.CommandSender
      Specified by:
      spigot in interface org.bukkit.entity.Entity
    • name

      @NotNull public @NotNull net.kyori.adventure.text.Component name()
      Specified by:
      name in interface org.bukkit.command.CommandSender
    • teamDisplayName

      @NotNull public @NotNull net.kyori.adventure.text.Component teamDisplayName()
      Specified by:
      teamDisplayName in interface org.bukkit.entity.Entity
    • asHoverEvent

      @NotNull public @NotNull net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent()
      Specified by:
      asHoverEvent in interface net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>
    • getOrigin

      @Nullable public @Nullable org.bukkit.Location getOrigin()
      Specified by:
      getOrigin in interface org.bukkit.entity.Entity
    • fromMobSpawner

      public boolean fromMobSpawner()
      Specified by:
      fromMobSpawner in interface org.bukkit.entity.Entity
    • getChunk

      @NotNull public @NotNull org.bukkit.Chunk getChunk()
      Specified by:
      getChunk in interface org.bukkit.entity.Entity
    • getEntitySpawnReason

      public @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason()
      Specified by:
      getEntitySpawnReason in interface org.bukkit.entity.Entity
    • isInRain

      public boolean isInRain()
      Specified by:
      isInRain in interface org.bukkit.entity.Entity
    • isInBubbleColumn

      public boolean isInBubbleColumn()
      Specified by:
      isInBubbleColumn in interface org.bukkit.entity.Entity
    • isInWaterOrRain

      public boolean isInWaterOrRain()
      Specified by:
      isInWaterOrRain in interface org.bukkit.entity.Entity
    • isInWaterOrBubbleColumn

      public boolean isInWaterOrBubbleColumn()
      Specified by:
      isInWaterOrBubbleColumn in interface org.bukkit.entity.Entity
    • isInWaterOrRainOrBubbleColumn

      public boolean isInWaterOrRainOrBubbleColumn()
      Specified by:
      isInWaterOrRainOrBubbleColumn in interface org.bukkit.entity.Entity
    • isInLava

      public boolean isInLava()
      Specified by:
      isInLava in interface org.bukkit.entity.Entity
    • isTicking

      public boolean isTicking()
      Specified by:
      isTicking in interface org.bukkit.entity.Entity
    • spawnAt

      public boolean spawnAt(@NotNull @NotNull org.bukkit.Location location)
      Specified by:
      spawnAt in interface org.bukkit.entity.Entity
    • spawnAt

      public boolean spawnAt(@NotNull @NotNull org.bukkit.Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason)
      Specified by:
      spawnAt in interface org.bukkit.entity.Entity
    • isInPowderedSnow

      public boolean isInPowderedSnow()
      Specified by:
      isInPowderedSnow in interface org.bukkit.entity.Entity