Interface SpecialBlock
- All Superinterfaces:
Metadatable
,PersistentStorage.Holder
- All Known Subinterfaces:
CustomBlock
,JoinArenaSignBlock
,RankingSignBlock
,RankingSkullBlock
A SpecialBlock represents a normal block with special (maybe even interactable) features.
They get automatically saved and loaded and it's possible to create custom variants using CustomBlock
-
Method Summary
Modifier and TypeMethodDescriptionasBukkit()
Returns Bukkit's variant of the block that's located at the same location as this onevoid
asBukkitAsync
(Consumer<Block> callback) Returns Bukkit's variant of the block that's located at the same location as this one.boolean
exists()
Returns if this block is still existing inside its WorldStorage.
Keep in mind that this varies per instance and that this instance is forever garbage when it returns falsegetType()
SpecialBlocks vary from the type they represent.getWorld()
Returns the world to which this block initially was added.
Keep in mind that the block might have been removed.int
getX()
Returns the x coordinate of this blockshort
getY()
Returns the y coordinate of this blockint
getZ()
Returns the z coordinate of this blockvoid
onInteract
(Player player, PlayerInteractEvent parentEvent) Call this if you want to simulate an interaction of the playerboolean
remove()
Tries to remove this block from its WorldStoragevoid
update()
Tries to apply the given informations into the game world.
By this e.g. a sign gets updated with the newly changed statsMethods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface de.marcely.bedwars.tools.PersistentStorage.Holder
getPersistentStorage
-
Method Details
-
getType
BlockType getType()SpecialBlocks vary from the type they represent. You may cast to the corresponding type after matching its type- Returns:
- The type of this SpecialBlock
-
getWorld
WorldStorage getWorld()Returns the world to which this block initially was added.
Keep in mind that the block might have been removed. You can verify it by callingexists()
- Returns:
- The world to which this block was added to
-
asBukkit
Block asBukkit()Returns Bukkit's variant of the block that's located at the same location as this one- Returns:
- The Block located at the same location as this one
-
asBukkitAsync
Returns Bukkit's variant of the block that's located at the same location as this one.If supported, it will uses paper's async chunk loading feature.
- Parameters:
callback
- The callback that is being called on the main thread
-
getX
int getX()Returns the x coordinate of this block- Returns:
- The x coordinate
-
getY
short getY()Returns the y coordinate of this block- Returns:
- The y coordinate
-
getZ
int getZ()Returns the z coordinate of this block- Returns:
- The z coordinate
-
update
void update()Tries to apply the given informations into the game world.
By this e.g. a sign gets updated with the newly changed stats -
onInteract
Call this if you want to simulate an interaction of the player- Parameters:
player
- The player who clicked on the signparentEvent
- The event which might contain info needed for the block
-
exists
boolean exists()Returns if this block is still existing inside its WorldStorage.
Keep in mind that this varies per instance and that this instance is forever garbage when it returns false- Returns:
- If this block still exists
-
remove
boolean remove()Tries to remove this block from its WorldStorage- Returns:
false
when it already has been removed. Otherwise true
-