Class ProtocolLib

java.lang.Object
com.ranull.graves.integration.ProtocolLib

public final class ProtocolLib extends Object
Provides integration with ProtocolLib to manage block changes and updates.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Graves
     
    private final com.comphenix.protocol.ProtocolManager
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new ProtocolLib instance with the specified Graves plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      private final Graves plugin
    • protocolManager

      private final com.comphenix.protocol.ProtocolManager protocolManager
  • Constructor Details

    • ProtocolLib

      public ProtocolLib(Graves plugin)
      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