Package be.seeseemelk.mockbukkit.entity
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>,CommandSender,Entity,Metadatable,Nameable,Permissible,ServerOperator,PersistentDataHolder
- Direct Known Subclasses:
AbstractProjectileMock,ExperienceOrbMock,HangingMock,ItemEntityMock,LivingEntityMock,SimpleEntityMock,VehicleMock
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.entity.Entity
Entity.Spigot -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEntityMock(@NotNull ServerMock server, @NotNull UUID uuid) -
Method Summary
Modifier and TypeMethodDescription@NotNull PermissionAttachmentaddAttachment(@NotNull Plugin plugin) addAttachment(@NotNull Plugin plugin, int ticks) @NotNull PermissionAttachmentaddAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks) booleanaddPassenger(@NotNull Entity passenger) booleanaddScoreboardTag(@NotNull String tag) @NotNull net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity>voidassertLocation(@NotNull Location expectedLocation, double maximumDistance) Assert that the actual location of the player is within a certain distance to a given location.voidAssert that the player hasn't teleported.voidassertTeleported(@NotNull Location expectedLocation, double maximumDistance) Assert that the player teleported to a certain location within a certain distance to a given location.voidClears the teleported flag.booleancollidesAt(@NotNull Location location) @Nullable net.kyori.adventure.text.ComponentvoidcustomName(@Nullable net.kyori.adventure.text.Component customName) booleaneject()final booleanboolean@NotNull BoundingBox@NotNull ChunkgetChunk()@NotNull Set<PermissionAttachmentInfo>int@NotNull CreatureSpawnEvent.SpawnReason@NotNull BlockFacefloatintintdouble@Nullable EntityDamageEvent@NotNull LocationgetLocation(@Nullable Location loc) intint@NotNull List<MetadataValue>getMetadata(@NotNull String metadataKey) @NotNull StringgetName()getNearbyEntities(double x, double y, double z) @Nullable LocationDeprecated.@NotNull PersistentDataContainer@NotNull PistonMoveReactionint@NotNull PosegetPose()@NotNull StringGets the scoreboard entry for this entity.@NotNull ServerMock@NotNull SpawnCategoryGet the cause of the last teleport.int@NotNull EntityTypegetType()@NotNull UUID@Nullable Entity@NotNull VectordoublegetWidth()@NotNull WorldgetWorld()booleanfinal inthashCode()booleanhasMetadata(@NotNull String metadataKey) booleanCheck if the entity has passengers.booleanhasPermission(@NotNull String name) booleanhasPermission(@NotNull Permission perm) booleanChecks if the player has been teleported since the last assert orclearTeleported().booleanbooleanisDead()booleanisEmpty()booleanbooleanisFrozen()booleanbooleanbooleanisInLava()booleanbooleanisInRain()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisOp()booleanisPermissionSet(@NotNull String name) booleanisPermissionSet(@NotNull Permission perm) booleanbooleanisSilent()booleanbooleanisValid()booleanbooleanvoidlockFreezeTicks(boolean locked) @NotNull net.kyori.adventure.text.Componentname()@Nullable net.kyori.adventure.text.ComponentReturns the next message that was sent to the target.voidplayEffect(@NotNull EntityEffect type) voidvoidremove()voidremoveAttachment(@NotNull PermissionAttachment attachment) voidremoveMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin) booleanremovePassenger(@NotNull Entity passenger) booleanremoveScoreboardTag(@NotNull String tag) voidsendMessage(@NotNull String message) voidsendMessage(@NotNull net.kyori.adventure.identity.Identity source, @NotNull net.kyori.adventure.text.Component message, @NotNull net.kyori.adventure.audience.MessageType type) voidsendMessage(@Nullable UUID sender, @NotNull String message) voidsendMessage(String... messages) voidsendMessage(UUID sender, String @NotNull ... messages) voidsetCustomName(@Nullable String name) voidsetCustomNameVisible(boolean flag) voidsetFallDistance(float distance) voidsetFireTicks(int ticks) voidsetFreezeTicks(int ticks) voidsetGlowing(boolean flag) voidsetGravity(boolean gravity) voidsetInvulnerable(boolean flag) voidsetLastDamageCause(@Nullable EntityDamageEvent event) voidsetLocation(@NotNull Location location) Sets the location of the entity.voidsetMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) voidSets the name of this entity.voidsetOp(boolean isOperator) booleansetPassenger(@NotNull Entity passenger) Deprecated.voidsetPersistent(boolean persistent) voidsetPortalCooldown(int cooldown) voidsetRotation(float yaw, float pitch) voidsetSilent(boolean flag) voidsetTicksLived(int value) voidsetVelocity(@NotNull Vector velocity) voidsetVisualFire(boolean fire) booleanbooleanspawnAt(@NotNull Location location, @NotNull CreatureSpawnEvent.SpawnReason reason) @NotNull Entity.Spigotspigot()@NotNull net.kyori.adventure.text.Componentbooleanbooleanteleport(@NotNull Entity destination, @NotNull PlayerTeleportEvent.TeleportCause cause) booleanbooleanteleport(@NotNull Location location, @NotNull PlayerTeleportEvent.TeleportCause cause) booleanteleport(@NotNull Location location, @NotNull PlayerTeleportEvent.TeleportCause cause, boolean ignorePassengers, boolean dismount) protected voidteleportWithoutEvent(@NotNull Location location, @NotNull PlayerTeleportEvent.TeleportCause cause) booleanwouldCollideUsing(@NotNull BoundingBox boundingBox) Methods inherited from class org.bukkit.command.CommandSender.Spigot
sendMessage, sendMessage, sendMessage, sendMessageMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.kyori.adventure.audience.Audience
clearTitle, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, showTitle, stopSound, stopSoundMethods inherited from interface org.bukkit.command.CommandSender
sendMessage, sendMessage, sendPlainMessage, sendRichMessageMethods inherited from interface org.bukkit.entity.Entity
asHoverEvent, teleport, teleport, teleport, teleportAsync, teleportAsyncMethods inherited from interface be.seeseemelk.mockbukkit.command.MessageTarget
assertNoMoreSaid, assertSaid, assertSaid, nextMessageMethods inherited from interface org.bukkit.permissions.Permissible
permissionValue, permissionValueMethods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
-
Constructor Details
-
EntityMock
-
-
Method Details
-
hashCode
public final int hashCode() -
equals
-
assertLocation
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
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 orclearTeleported().- Returns:
trueif the player has been teleported,falseif he hasn't been teleported.
-
clearTeleported
public void clearTeleported()Clears the teleported flag. -
getTeleportCause
Get the cause of the last teleport.- Returns:
- The cause of the last teleport.
-
getUniqueId
- Specified by:
getUniqueIdin interfaceEntity
-
getLocation
- Specified by:
getLocationin interfaceEntity
-
getTrackedPlayers
- Specified by:
getTrackedPlayersin interfaceEntity
-
getLocation
- Specified by:
getLocationin interfaceEntity
-
setLocation
Sets the location of the entity. Note that this will not fire a teleport event.- Parameters:
location- The new location of the entity.
-
getWorld
-
setMetadata
public void setMetadata(@NotNull @NotNull String metadataKey, @NotNull @NotNull MetadataValue newMetadataValue) - Specified by:
setMetadatain interfaceMetadatable
-
getMetadata
- Specified by:
getMetadatain interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadatain interfaceMetadatable
-
removeMetadata
public void removeMetadata(@NotNull @NotNull String metadataKey, @NotNull @NotNull Plugin owningPlugin) - Specified by:
removeMetadatain interfaceMetadatable
-
getPersistentDataContainer
- Specified by:
getPersistentDataContainerin interfacePersistentDataHolder
-
teleport
-
teleport
public boolean teleport(@NotNull @NotNull Location location, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause) -
teleport
public boolean teleport(@NotNull @NotNull Location location, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause, boolean ignorePassengers, boolean dismount) -
teleportWithoutEvent
protected void teleportWithoutEvent(@NotNull @NotNull Location location, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause) -
teleport
-
teleport
public boolean teleport(@NotNull @NotNull Entity destination, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause) -
isOp
public boolean isOp()- Specified by:
isOpin interfaceServerOperator
-
setOp
public void setOp(boolean isOperator) - Specified by:
setOpin interfaceServerOperator
-
getName
- Specified by:
getNamein interfaceCommandSender
-
getScoreboardEntry
Gets the scoreboard entry for this entity.- Returns:
- The scoreboard entry.
-
setName
Sets the name of this entity.- Parameters:
name- The new name of the entity.
-
sendMessage
- Specified by:
sendMessagein interfaceCommandSender
-
sendMessage
- Specified by:
sendMessagein interfaceCommandSender
-
sendMessage
- Specified by:
sendMessagein interfaceCommandSender
-
sendMessage
- Specified by:
sendMessagein interfaceCommandSender
-
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:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Specified by:
sendMessagein interfaceCommandSender
-
nextComponentMessage
@Nullable public @Nullable net.kyori.adventure.text.Component nextComponentMessage()Description copied from interface:MessageTargetReturns the next message that was sent to the target.- Specified by:
nextComponentMessagein interfaceMessageTarget- Returns:
- The next message sent to the target.
-
isPermissionSet
- Specified by:
isPermissionSetin interfacePermissible
-
isPermissionSet
- Specified by:
isPermissionSetin interfacePermissible
-
hasPermission
- Specified by:
hasPermissionin interfacePermissible
-
hasPermission
- Specified by:
hasPermissionin interfacePermissible
-
addAttachment
@NotNull public @NotNull PermissionAttachment addAttachment(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String name, boolean value) - Specified by:
addAttachmentin interfacePermissible
-
addAttachment
- Specified by:
addAttachmentin interfacePermissible
-
addAttachment
public PermissionAttachment addAttachment(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String name, boolean value, int ticks) - Specified by:
addAttachmentin interfacePermissible
-
addAttachment
- Specified by:
addAttachmentin interfacePermissible
-
removeAttachment
- Specified by:
removeAttachmentin interfacePermissible
-
recalculatePermissions
public void recalculatePermissions()- Specified by:
recalculatePermissionsin interfacePermissible
-
getEffectivePermissions
- Specified by:
getEffectivePermissionsin interfacePermissible
-
customName
@Nullable public @Nullable net.kyori.adventure.text.Component customName()- Specified by:
customNamein interfaceNameable
-
customName
public void customName(@Nullable @Nullable net.kyori.adventure.text.Component customName) - Specified by:
customNamein interfaceNameable
-
getCustomName
- Specified by:
getCustomNamein interfaceNameable
-
setCustomName
- Specified by:
setCustomNamein interfaceNameable
-
setVelocity
- Specified by:
setVelocityin interfaceEntity
-
getVelocity
- Specified by:
getVelocityin interfaceEntity
-
getHeight
public double getHeight() -
getWidth
public double getWidth() -
isOnGround
public boolean isOnGround()- Specified by:
isOnGroundin interfaceEntity
-
getNearbyEntities
- Specified by:
getNearbyEntitiesin interfaceEntity
-
getEntityId
public int getEntityId()- Specified by:
getEntityIdin interfaceEntity
-
getFireTicks
public int getFireTicks()- Specified by:
getFireTicksin interfaceEntity
-
getMaxFireTicks
public int getMaxFireTicks()- Specified by:
getMaxFireTicksin interfaceEntity
-
setFireTicks
public void setFireTicks(int ticks) - Specified by:
setFireTicksin interfaceEntity
-
setVisualFire
public void setVisualFire(boolean fire) - Specified by:
setVisualFirein interfaceEntity
-
isVisualFire
public boolean isVisualFire()- Specified by:
isVisualFirein interfaceEntity
-
setFreezeTicks
public void setFreezeTicks(int ticks) - Specified by:
setFreezeTicksin interfaceEntity
-
isFrozen
public boolean isFrozen() -
isFreezeTickingLocked
public boolean isFreezeTickingLocked()- Specified by:
isFreezeTickingLockedin interfaceEntity
-
lockFreezeTicks
public void lockFreezeTicks(boolean locked) - Specified by:
lockFreezeTicksin interfaceEntity
-
getFreezeTicks
public int getFreezeTicks()- Specified by:
getFreezeTicksin interfaceEntity
-
getMaxFreezeTicks
public int getMaxFreezeTicks()- Specified by:
getMaxFreezeTicksin interfaceEntity
-
remove
public void remove() -
isDead
public boolean isDead() -
isValid
public boolean isValid() -
getServer
- Specified by:
getServerin interfaceCommandSender- Specified by:
getServerin interfaceEntity
-
getPassenger
Deprecated.- Specified by:
getPassengerin interfaceEntity
-
setPassenger
Deprecated.- Specified by:
setPassengerin interfaceEntity
-
getPassengers
- Specified by:
getPassengersin interfaceEntity
-
addPassenger
- Specified by:
addPassengerin interfaceEntity
-
removePassenger
- Specified by:
removePassengerin interfaceEntity
-
isEmpty
public boolean isEmpty() -
hasPassengers
public boolean hasPassengers()Check if the entity has passengers.Convenience method for
isEmpty().- Returns:
trueif there is at least one passenger.
-
eject
public boolean eject() -
getFallDistance
public float getFallDistance()- Specified by:
getFallDistancein interfaceEntity
-
setFallDistance
public void setFallDistance(float distance) - Specified by:
setFallDistancein interfaceEntity
-
setLastDamageCause
- Specified by:
setLastDamageCausein interfaceEntity
-
getLastDamageCause
- Specified by:
getLastDamageCausein interfaceEntity
-
getTicksLived
public int getTicksLived()- Specified by:
getTicksLivedin interfaceEntity
-
setTicksLived
public void setTicksLived(int value) - Specified by:
setTicksLivedin interfaceEntity
-
playEffect
- Specified by:
playEffectin interfaceEntity
-
getType
-
isInsideVehicle
public boolean isInsideVehicle()- Specified by:
isInsideVehiclein interfaceEntity
-
leaveVehicle
public boolean leaveVehicle()- Specified by:
leaveVehiclein interfaceEntity
-
getVehicle
- Specified by:
getVehiclein interfaceEntity
-
setCustomNameVisible
public void setCustomNameVisible(boolean flag) - Specified by:
setCustomNameVisiblein interfaceEntity
-
isCustomNameVisible
public boolean isCustomNameVisible()- Specified by:
isCustomNameVisiblein interfaceEntity
-
setGlowing
public void setGlowing(boolean flag) - Specified by:
setGlowingin interfaceEntity
-
isGlowing
public boolean isGlowing() -
setInvulnerable
public void setInvulnerable(boolean flag) - Specified by:
setInvulnerablein interfaceEntity
-
isInvulnerable
public boolean isInvulnerable()- Specified by:
isInvulnerablein interfaceEntity
-
isSilent
public boolean isSilent() -
setSilent
public void setSilent(boolean flag) -
hasGravity
public boolean hasGravity()- Specified by:
hasGravityin interfaceEntity
-
setGravity
public void setGravity(boolean gravity) - Specified by:
setGravityin interfaceEntity
-
getPortalCooldown
public int getPortalCooldown()- Specified by:
getPortalCooldownin interfaceEntity
-
setPortalCooldown
public void setPortalCooldown(int cooldown) - Specified by:
setPortalCooldownin interfaceEntity
-
getScoreboardTags
- Specified by:
getScoreboardTagsin interfaceEntity
-
addScoreboardTag
- Specified by:
addScoreboardTagin interfaceEntity
-
removeScoreboardTag
- Specified by:
removeScoreboardTagin interfaceEntity
-
getPistonMoveReaction
- Specified by:
getPistonMoveReactionin interfaceEntity
-
setRotation
public void setRotation(float yaw, float pitch) - Specified by:
setRotationin interfaceEntity
-
getBoundingBox
- Specified by:
getBoundingBoxin interfaceEntity
-
isPersistent
public boolean isPersistent()- Specified by:
isPersistentin interfaceEntity
-
setPersistent
public void setPersistent(boolean persistent) - Specified by:
setPersistentin interfaceEntity
-
getFacing
-
getPose
-
isInWater
public boolean isInWater() -
getSpawnCategory
- Specified by:
getSpawnCategoryin interfaceEntity
-
spigot
- Specified by:
spigotin interfaceCommandSender- Specified by:
spigotin interfaceEntity
-
name
@NotNull public @NotNull net.kyori.adventure.text.Component name()- Specified by:
namein interfaceCommandSender
-
teamDisplayName
@NotNull public @NotNull net.kyori.adventure.text.Component teamDisplayName()- Specified by:
teamDisplayNamein interfaceEntity
-
asHoverEvent
@NotNull public @NotNull net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent()- Specified by:
asHoverEventin interfacenet.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>
-
getOrigin
-
fromMobSpawner
public boolean fromMobSpawner()- Specified by:
fromMobSpawnerin interfaceEntity
-
getChunk
-
getEntitySpawnReason
- Specified by:
getEntitySpawnReasonin interfaceEntity
-
isInRain
public boolean isInRain() -
isInBubbleColumn
public boolean isInBubbleColumn()- Specified by:
isInBubbleColumnin interfaceEntity
-
isInWaterOrRain
public boolean isInWaterOrRain()- Specified by:
isInWaterOrRainin interfaceEntity
-
isInWaterOrBubbleColumn
public boolean isInWaterOrBubbleColumn()- Specified by:
isInWaterOrBubbleColumnin interfaceEntity
-
isInWaterOrRainOrBubbleColumn
public boolean isInWaterOrRainOrBubbleColumn()- Specified by:
isInWaterOrRainOrBubbleColumnin interfaceEntity
-
isInLava
public boolean isInLava() -
isTicking
public boolean isTicking() -
spawnAt
-
spawnAt
public boolean spawnAt(@NotNull @NotNull Location location, @NotNull CreatureSpawnEvent.SpawnReason reason) -
isInPowderedSnow
public boolean isInPowderedSnow()- Specified by:
isInPowderedSnowin interfaceEntity
-
collidesAt
- Specified by:
collidesAtin interfaceEntity
-
wouldCollideUsing
- Specified by:
wouldCollideUsingin interfaceEntity
-