Interface CommandBlock
- All Superinterfaces:
BlockState, CommandBlockHolder, Metadatable, PersistentDataHolder, PersistentDataViewHolder, 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.voidSets the name of this CommandBlock.voidsetCommand(@Nullable String command) Sets the command that this CommandBlock will run when powered.voidDeprecated.in favour ofname(net.kyori.adventure.text.Component)Methods inherited from interface BlockState
copy, copy, getBlock, getBlockData, getChunk, getData, getDrops, getDrops, getDrops, getLightLevel, getLocation, getLocation, getRawData, getType, getWorld, getX, getY, getZ, isCollidable, isPlaced, isSuffocating, setBlockData, setData, setRawData, setType, update, update, updateMethods inherited from interface CommandBlockHolder
getSuccessCount, lastOutput, lastOutput, setSuccessCountMethods inherited from interface Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadataMethods inherited from interface 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:
getCommandin 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:
setCommandin 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.- 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 aTextComponentcontaining@.- Returns:
- Name of this CommandBlock.
-
name
-
name()