Interface LightningStrike
- All Superinterfaces:
Audience
,CommandSender
,Entity
,HoverEventSource<HoverEvent.ShowEntity>
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,Pointered
,ServerOperator
,Sound.Emitter
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the potential entity that caused this lightning strike to spawn in the world.int
Returns the amount of flash iterations that will be done before the lightning dies.int
Returns the amount of ticks the current flash will do damage for.boolean
isEffect()
Returns whether the strike is an effect that does no damage.void
setCausingPlayer
(@Nullable Player causingPlayer) Updates the player that caused this lightning to be summoned into the world.void
setFlashCount
(int flashes) Sets the amount of life iterations that will be done before the lightning dies.void
setLifeTicks
(int lifeTicks) Sets the amount of ticks the current flash will do damage/fire for.spigot()
Methods inherited from interface net.kyori.adventure.audience.Audience
clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, 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, collidesAt, eject, fromMobSpawner, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPitch, getPortalCooldown, getPose, getScheduler, getScoreboardEntryName, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, getX, getY, getYaw, getZ, hasFixedPose, hasGravity, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isInBubbleColumn, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isOnGround, isPersistent, isSilent, isSneaking, isTicking, isUnderWater, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setPose, setPose, setRotation, setSilent, setSneaking, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spawnAt, spawnAt, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, 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
-
spigot
- 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
-
getLifeTicks
int getLifeTicks()Returns the amount of ticks the current flash will do damage for. Starts with 2 by default, will damage while it is equal to or above 0, with the next flash beginning somewhere between 0 and -9.- Returns:
- ticks the current flash will do damage for
-
setLifeTicks
void setLifeTicks(int lifeTicks) Sets the amount of ticks the current flash will do damage/fire for. Default is 2 for each flash, on which the sound and effect will also be played.- Parameters:
lifeTicks
- ticks the current flash will do damage for
-
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)
-
setCausingPlayer
Updates the player that caused this lightning to be summoned into the world. By default, players that channel theirTrident
will be the cause of the respective lightning.While the respective getter method
getCausingEntity()
does not guarantee a player as the cause of a lightning to stay as future proof as possible, as of implementing this method, players are the only entities that can cause a lightning strike and hence this setter is restricted to players.- Parameters:
causingPlayer
- the player that should be the new cause of this lightning.null
may be passed to indicate that no player is responsible for this lightning.
-