Package com.ranull.graves.integration
Class ProtocolLib
java.lang.Object
com.ranull.graves.integration.ProtocolLib
Provides integration with ProtocolLib to manage block changes and updates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Graves
private final com.comphenix.protocol.ProtocolManager
-
Constructor Summary
ConstructorsConstructorDescriptionProtocolLib
(Graves plugin) Constructs a new ProtocolLib instance with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate com.comphenix.protocol.events.PacketContainer
createBlockChangePacket
(org.bukkit.block.Block block, com.comphenix.protocol.wrappers.WrappedBlockData wrappedBlockData) Creates a PacketContainer for a block change packet.void
refreshBlock
(org.bukkit.block.Block block, org.bukkit.entity.Player player) Refreshes the block at a specific location to reflect its current state.private void
sendServerPacket
(org.bukkit.entity.Player player, com.comphenix.protocol.events.PacketContainer packetContainer) Sends a server packet to a specific player.void
setBlock
(org.bukkit.block.Block block, org.bukkit.Material material, org.bukkit.entity.Player player) Sets the block at a specific location to a new material and updates the client.
-
Field Details
-
plugin
-
protocolManager
private final com.comphenix.protocol.ProtocolManager protocolManager
-
-
Constructor Details
-
ProtocolLib
Constructs a new ProtocolLib instance with the specified Graves plugin.- Parameters:
plugin
- The main Graves plugin instance.
-
-
Method Details
-
setBlock
public void setBlock(org.bukkit.block.Block block, org.bukkit.Material material, org.bukkit.entity.Player player) throws InvocationTargetException Sets the block at a specific location to a new material and updates the client.- Parameters:
block
- The block to change.material
- The material to set the block to.player
- The player to whom the update will be sent.- Throws:
InvocationTargetException
-
refreshBlock
public void refreshBlock(org.bukkit.block.Block block, org.bukkit.entity.Player player) throws InvocationTargetException Refreshes the block at a specific location to reflect its current state.- Parameters:
block
- The block to refresh.player
- The player to whom the update will be sent.- Throws:
InvocationTargetException
-
createBlockChangePacket
private com.comphenix.protocol.events.PacketContainer createBlockChangePacket(org.bukkit.block.Block block, com.comphenix.protocol.wrappers.WrappedBlockData wrappedBlockData) Creates a PacketContainer for a block change packet.- Parameters:
block
- The block to change.wrappedBlockData
- The block data to set.- Returns:
- The PacketContainer for the block change packet.
-
sendServerPacket
private void sendServerPacket(org.bukkit.entity.Player player, com.comphenix.protocol.events.PacketContainer packetContainer) throws InvocationTargetException Sends a server packet to a specific player.- Parameters:
player
- The player to send the packet to.packetContainer
- The packet to send.- Throws:
InvocationTargetException
-