Class PacketBlockGroup
java.lang.Object
net.bitbylogic.packetblocks.group.PacketBlockGroup
- All Implemented Interfaces:
PacketBlockHolder<Map<net.bitbylogic.utils.location.WorldPosition,,org.bukkit.block.data.BlockData>, GroupPacketBlockViewer> DataHolder<Map<net.bitbylogic.utils.location.WorldPosition,,org.bukkit.block.data.BlockData>, GroupPacketBlockViewer> MetadataHolder,ViewerHolder<Map<net.bitbylogic.utils.location.WorldPosition,org.bukkit.block.data.BlockData>, GroupPacketBlockViewer>
public class PacketBlockGroup
extends Object
implements PacketBlockHolder<Map<net.bitbylogic.utils.location.WorldPosition,org.bukkit.block.data.BlockData>,GroupPacketBlockViewer>
-
Constructor Summary
ConstructorsConstructorDescriptionPacketBlockGroup(@NonNull Map<org.bukkit.Location, org.bukkit.block.data.BlockData> blockLocations) PacketBlockGroup(@NonNull Map<org.bukkit.Location, org.bukkit.block.data.BlockData> blockLocations, int breakSpeed) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocation(@NonNull org.bukkit.Location location, @NonNull org.bukkit.block.data.BlockData blockData) Adds a specific block location along with its corresponding block data to the internal data structure.voidaddLocations(@NonNull Map<org.bukkit.Location, org.bukkit.block.data.BlockData> locations) Adds multiple block locations along with their corresponding block data to the internal data structure.booleanexistsAt(@NonNull org.bukkit.Location location) booleanexistsIn(@NonNull org.bukkit.World world) List<org.bukkit.block.BlockState> getBlockStates(@NonNull org.bukkit.entity.Player player) Optional<org.bukkit.block.data.BlockData> getDataAt(@Nullable org.bukkit.entity.Player player, @NonNull org.bukkit.Location location) voidremoveLocation(@NonNull org.bukkit.Location location) Removes a specific block location from the group and optionally sends an update to the viewers.protected voidremoveLocation(@NonNull org.bukkit.Location location, boolean sendUpdate) voidremoveLocations(@NonNull List<org.bukkit.Location> locations) Removes the specified list of locations from the internal data structure and notifies all viewers about the changes in those locations.voidsendUpdate(@NonNull org.bukkit.entity.Player player) Sends a block update to the specified player at the current location.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.bitbylogic.packetblocks.data.DataHolder
getBoundingBoxes, getBreakSpeed, getBreakSpeed, getData, getData, getDataHandler, isAddViewerOnJoin, isGlobalBreakAnimation, sendUpdates, setAddViewerOnJoin, setBlockDataAndUpdate, setBreakSpeed, setData, setData, setDataForAll, setDataSupplier, setDataSupplierForAll, setGlobalBreakAnimationMethods inherited from interface net.bitbylogic.packetblocks.metadata.MetadataHolder
addMetadata, getMetadata, getMetadata, getMetadataAs, getMetadataHandler, hasMetadata, removeMetadataMethods inherited from interface net.bitbylogic.packetblocks.viewer.ViewerHolder
addAndUpdateViewer, addMetadata, addViewCondition, addViewer, attemptAddViewer, canView, getMetadata, getMetadataAs, getViewer, getViewerHandler, getViewers, hasMetadata, isViewer, removeMetadata, removeViewer
-
Constructor Details
-
Method Details
-
addLocations
public void addLocations(@NonNull @NonNull Map<org.bukkit.Location, org.bukkit.block.data.BlockData> locations) Adds multiple block locations along with their corresponding block data to the internal data structure. Updates are sent to all viewers tracking the block group, and the necessary metadata is updated accordingly.NOTE: Do not call this yourself, use
PacketBlockManager.addBlocksToGroup(PacketBlockGroup, Map)- Parameters:
locations- a map containing theLocationof each block and its associatedBlockData; must not be null
-
addLocation
public void addLocation(@NonNull @NonNull org.bukkit.Location location, @NonNull @NonNull org.bukkit.block.data.BlockData blockData) Adds a specific block location along with its corresponding block data to the internal data structure. Updates are sent to all viewers tracking the block group, and necessary metadata is updated accordingly.NOTE: Do not call this yourself, use
PacketBlockManager.addBlockToGroup(PacketBlockGroup, Location, BlockData)- Parameters:
location- theLocationof the block to be added; must not be nullblockData- theBlockDataassociated with the block at the given location; must not be null
-
removeLocations
Removes the specified list of locations from the internal data structure and notifies all viewers about the changes in those locations.NOTE: Do not call this yourself, use
PacketBlockManager.removeBlocksFromGroup(PacketBlockGroup, List)- Parameters:
locations- A list ofLocationobjects to be removed. Each location in the list will be processed to update the internal state and notify the viewers of changes.
-
removeLocation
public void removeLocation(@NonNull @NonNull org.bukkit.Location location) Removes a specific block location from the group and optionally sends an update to the viewers.NOTE: Do not call this yourself, use
PacketBlockManager.removeBlockFromGroup(PacketBlockGroup, Location)- Parameters:
location- theLocationof the block to remove; must not be null
-
removeLocation
protected void removeLocation(@NonNull @NonNull org.bukkit.Location location, boolean sendUpdate) -
getBlockStates
public List<org.bukkit.block.BlockState> getBlockStates(@NonNull @NonNull org.bukkit.entity.Player player) -
getDataAt
public Optional<org.bukkit.block.data.BlockData> getDataAt(@Nullable @Nullable org.bukkit.entity.Player player, @NonNull @NonNull org.bukkit.Location location) -
sendUpdate
public void sendUpdate(@NonNull @NonNull org.bukkit.entity.Player player) Sends a block update to the specified player at the current location.- Specified by:
sendUpdatein interfacePacketBlockHolder<Map<net.bitbylogic.utils.location.WorldPosition,org.bukkit.block.data.BlockData>, GroupPacketBlockViewer> - Parameters:
player- the player to whom the block update will be sent
-
existsIn
public boolean existsIn(@NonNull @NonNull org.bukkit.World world) - Specified by:
existsInin interfacePacketBlockHolder<Map<net.bitbylogic.utils.location.WorldPosition,org.bukkit.block.data.BlockData>, GroupPacketBlockViewer>
-
existsAt
public boolean existsAt(@NonNull @NonNull org.bukkit.Location location) - Specified by:
existsAtin interfacePacketBlockHolder<Map<net.bitbylogic.utils.location.WorldPosition,org.bukkit.block.data.BlockData>, GroupPacketBlockViewer>
-