Package net.bitbylogic.packetblocks.data
Interface DataHolder<T,V extends PacketBlockViewer<T>>
- All Known Subinterfaces:
PacketBlockHolder<T,V>
- All Known Implementing Classes:
PacketBlock,PacketBlockGroup
public interface DataHolder<T,V extends PacketBlockViewer<T>>
-
Method Summary
Modifier and TypeMethodDescriptiondefault List<org.bukkit.util.BoundingBox> default intdefault intgetBreakSpeed(@NonNull org.bukkit.entity.Player player) Calculates and retrieves the break speed for the given player.default TgetData()default TgetData(@Nullable org.bukkit.entity.Player player) @NonNull DataHandler<T, V> default booleandefault booleandefault voidSends block updates to all the viewers currently tracking the block at the specified location.default voidsetAddViewerOnJoin(boolean addViewerOnJoin) default voidsetBlockDataAndUpdate(@NonNull org.bukkit.entity.Player player, T data) Sets the block data for the specified player and sends an update.default voidsetBreakSpeed(int breakSpeed) default voidSets the data for a specific player.default voiddefault voidsetDataForAll(T data) Sets the data for all viewers and updates them accordingly.default voidsetDataSupplier(@NonNull org.bukkit.entity.Player player, T data) Sets the data supplier for a specific player, allowing for dynamic control over block data.default voidsetDataSupplierForAll(T data) Sets the block data supplier for all viewers and updates the block data for each viewer based on the provided BlockData.default voidsetGlobalBreakAnimation(boolean globalBreakAnimation)
-
Method Details
-
getDataHandler
-
setDataForAll
Sets the data for all viewers and updates them accordingly.- Parameters:
data- the block data to be set for all viewers
-
setDataSupplierForAll
Sets the block data supplier for all viewers and updates the block data for each viewer based on the provided BlockData.- Parameters:
data- the BlockData object to be supplied to all viewers
-
setData
Sets the data for a specific player.- Parameters:
player- the player for whom the block data is being set; must not be nulldata- the data to associate with the player; can be null to reset or remove the block data
-
setDataSupplier
Sets the data supplier for a specific player, allowing for dynamic control over block data.- Parameters:
player- the player for whom the BlockData supplier is being set, must not be nulldata- the data object to be supplied, must not be null
-
setBlockDataAndUpdate
default void setBlockDataAndUpdate(@NonNull @NonNull org.bukkit.entity.Player player, @Nullable T data) Sets the block data for the specified player and sends an update.- Parameters:
player- the player for whom the block data is being set, must not be nulldata- the block data to be set, can be null
-
getBreakSpeed
default int getBreakSpeed(@NonNull @NonNull org.bukkit.entity.Player player) Calculates and retrieves the break speed for the given player.- Parameters:
player- the player whose break speed is being requested, must not be null- Returns:
- the calculated break speed for the player; returns a default value if not available
-
sendUpdates
default void sendUpdates()Sends block updates to all the viewers currently tracking the block at the specified location.This method iterates through all viewers stored in the `viewers` map and attempts to send a block update to each. If a viewer no longer exists or is offline, they are removed from the `viewers` map.
The block state sent to each viewer is dependent on the `getBlockState(Player)` implementation, which determines the block's appearance based on the specific viewer.
-
getBoundingBoxes
-
getData
-
getData
-
isAddViewerOnJoin
default boolean isAddViewerOnJoin() -
isGlobalBreakAnimation
default boolean isGlobalBreakAnimation() -
getBreakSpeed
default int getBreakSpeed() -
setBreakSpeed
default void setBreakSpeed(int breakSpeed) -
setAddViewerOnJoin
default void setAddViewerOnJoin(boolean addViewerOnJoin) -
setGlobalBreakAnimation
default void setGlobalBreakAnimation(boolean globalBreakAnimation) -
setData
-