Interface LightningStrike
- All Superinterfaces:
Audience
,CommandSender
,Entity
,HoverEventSource<HoverEvent.ShowEntity>
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,PersistentDataViewHolder
,Pointered
,ServerOperator
,Sound.Emitter
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Deprecated.Unsupported api -
Method Summary
Modifier and TypeMethodDescriptionReturns the potential entity that caused this lightning strike to spawn in the world.Get thePlayer
that caused this lightning to strike.int
Returns the amount of flash iterations that will be done before the lightning dies.int
Deprecated.usegetFlashCount()
int
Get the amount of ticks this lightning strike will inflict damage upon its hit entities.boolean
isEffect()
Returns whether the strike is an effect that does no damage.void
setCausingPlayer
(@Nullable Player player) Set thePlayer
that caused this lightning to strike.void
setFlashCount
(int flashes) Sets the amount of life iterations that will be done before the lightning dies.void
setFlashes
(int flashes) Deprecated.void
setLifeTicks
(int ticks) Get the amount of ticks this lightning strike will inflict damage upon its hit entities.spigot()
Deprecated.Unsupported apiMethods inherited from interface net.kyori.adventure.audience.Audience
clearResourcePacks, clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, sendTitlePart, showBossBar, showTitle, stopSound, stopSound
Methods inherited from interface org.bukkit.command.CommandSender
getName, name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlainMessage, sendRichMessage, sendRichMessage
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, asHoverEvent, broadcastHurtAnimation, collidesAt, copy, copy, createSnapshot, eject, fromMobSpawner, getAsString, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPitch, getPortalCooldown, getPose, getRider, getScheduler, getScoreboardEntryName, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, getX, getY, getYaw, getZ, hasFixedPose, hasGravity, hasNoPhysics, hasRider, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isImmuneToFire, isInBubbleColumn, isInDaylight, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvisible, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isInWorld, isOnGround, isPersistent, isRidable, isRidableInWater, isSilent, isSneaking, isTicking, isUnderWater, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setImmuneToFire, setInvisible, setInvulnerable, setLastDamageCause, setNoPhysics, setPassenger, setPersistent, setPortalCooldown, setPose, setPose, setRotation, setSilent, setSneaking, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spawnAt, spawnAt, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync, teleportAsync, wouldCollideUsing
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.Nameable
customName, customName, getCustomName, setCustomName
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
Method Details
-
isEffect
boolean isEffect()Returns whether the strike is an effect that does no damage.- Returns:
- whether the strike is an effect
-
getFlashes
Deprecated.usegetFlashCount()
Get the amount of flashes that will occur before the lightning is removed. By default this value is between 1 and 3.- Returns:
- the flashes
-
setFlashes
Deprecated.Set the amount of flashes that will occur before the lightning is removed. One flash will occur after this lightning strike's life has reduced below 0.- Parameters:
flashes
- the flashes
-
getLifeTicks
int getLifeTicks()Get the amount of ticks this lightning strike will inflict damage upon its hit entities.When life ticks are negative, there is a random chance that another flash will be initiated and life ticks reset to 1.
- Returns:
- the life ticks
-
setLifeTicks
void setLifeTicks(int ticks) Get the amount of ticks this lightning strike will inflict damage upon its hit entities.When life ticks are negative, there is a random chance that another flash will be initiated and life ticks reset to 1. Additionally, if life ticks are set to 2 (the default value when a lightning strike has been spawned), a list of events will occur:
- Impact sound effects will be played
- Fire will be spawned (dependent on difficulty)
- Lightning rods will be powered (if hit)
- Copper will be stripped (if hit)
GameEvent.LIGHTNING_STRIKE
will be dispatched
- Parameters:
ticks
- the life ticks
-
getCausingPlayer
Get thePlayer
that caused this lightning to strike. This will occur naturally if a trident enchanted withChanneling
were thrown at an entity during a storm.- Returns:
- the player
-
setCausingPlayer
Set thePlayer
that caused this lightning to strike.- Parameters:
player
- the player
-
spigot
Deprecated.Unsupported api- Specified by:
spigot
in interfaceCommandSender
- Specified by:
spigot
in interfaceEntity
-
getFlashCount
int getFlashCount()Returns the amount of flash iterations that will be done before the lightning dies.- Returns:
- amount of flashes that will be shown before the lightning dies
- See Also:
-
setFlashCount
void setFlashCount(int flashes) Sets the amount of life iterations that will be done before the lightning dies. Default number of flashes on creation is between 1-3.- Parameters:
flashes
- amount of iterations that will be done before the lightning dies, must to be a positive number
-
getCausingEntity
Returns the potential entity that caused this lightning strike to spawn in the world.As of implementing this method, only
Player
s are capable of causing a lightning strike, however as this might change in future minecraft releases, this method does not guarantee a player as the cause of a lightning. Consumers of this method should hence validate whether or not the entity is a player if they want to use player specific methods through aninstanceOf
check.A player is, as of implementing this method, responsible for a lightning, and will hence be returned here as a cause, if they channeled a
Trident
to summon it or were explicitly defined as the cause of this lightning throughsetCausingPlayer(Player)
.- Returns:
- the entity that caused this lightning or null if the lightning was not caused by a entity (e.g. normal weather)
-