Package org.bukkit.block
Interface CommandBlock
- All Superinterfaces:
BlockState
,CommandBlockHolder
,Metadatable
,PersistentDataHolder
,TileState
Represents a captured state of a command block.
-
Method Summary
Modifier and TypeMethodDescriptionGets the command that this CommandBlock will run when powered.getName()
Deprecated.name()
Gets the name of this CommandBlock.void
Sets the name of this CommandBlock.void
setCommand
(@Nullable String command) Sets the command that this CommandBlock will run when powered.void
Deprecated.in favour ofname(net.kyori.adventure.text.Component)
Methods inherited from interface org.bukkit.block.BlockState
getBlock, getBlockData, getChunk, getData, getDrops, getDrops, getDrops, getLightLevel, getLocation, getLocation, getRawData, getType, getWorld, getX, getY, getZ, isCollidable, isPlaced, setBlockData, setData, setRawData, setType, update, update, update
Methods inherited from interface io.papermc.paper.command.CommandBlockHolder
getSuccessCount, lastOutput, lastOutput, setSuccessCount
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.block.TileState
getPersistentDataContainer, isSnapshot
-
Method Details
-
getCommand
Gets the command that this CommandBlock will run when powered. This will never return null. If the CommandBlock does not have a command, an empty String will be returned instead.- Specified by:
getCommand
in interfaceCommandBlockHolder
- Returns:
- Command that this CommandBlock will run when powered.
-
setCommand
Sets the command that this CommandBlock will run when powered. Setting the command to null is the same as setting it to an empty String.- Specified by:
setCommand
in interfaceCommandBlockHolder
- Parameters:
command
- Command that this CommandBlock will run when powered.
-
getName
Deprecated.in favour ofname()
Gets the name of this CommandBlock. The name is used with commands that this CommandBlock executes. This name will never be null, and by default is "@".- Returns:
- Name of this CommandBlock.
-
setName
Deprecated.in favour ofname(net.kyori.adventure.text.Component)
Sets the name of this CommandBlock. The name is used with commands that this CommandBlock executes. Setting the name to null is the same as setting it to "@".- Parameters:
name
- New name for this CommandBlock.
-
name
Gets the name of this CommandBlock. The name is used with commands that this CommandBlock executes. This name will never be null, and by default is aTextComponent
containing@
.- Returns:
- Name of this CommandBlock.
-
name
Sets the name of this CommandBlock. The name is used with commands that this CommandBlock executes. Setting the name to null is the same as setting it to aTextComponent
containing@
.- Parameters:
name
- New name for this CommandBlock.
-
name()