Class PacketBlockUtil

java.lang.Object
net.bitbylogic.packetblocks.util.PacketBlockUtil

public class PacketBlockUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.Material
    getBlockType(@NonNull org.bukkit.entity.Player player, @NonNull org.bukkit.Location location)
    Retrieves the material type of the block at a specific location for a given player.
    static org.bukkit.util.RayTraceResult
    rayTrace(org.bukkit.entity.Player player, double range)
    Performs a ray trace from the player's eye location along their current direction up to the specified range.

    Methods inherited from class java.lang.Object

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

    • PacketBlockUtil

      public PacketBlockUtil()
  • Method Details

    • getBlockType

      public static org.bukkit.Material getBlockType(@NonNull @NonNull org.bukkit.entity.Player player, @NonNull @NonNull org.bukkit.Location location)
      Retrieves the material type of the block at a specific location for a given player. This method first checks for any custom packet-based block at the provided location and, if present, determines the block type specific to the player. If no custom block exists, it returns the material type of the actual block at the location.
      Parameters:
      player - the player for whom the block type is determined; must not be null
      location - the location of the block to check; must not be null
      Returns:
      the material representing the block type at the specified location
    • rayTrace

      public static org.bukkit.util.RayTraceResult rayTrace(org.bukkit.entity.Player player, double range)
      Performs a ray trace from the player's eye location along their current direction up to the specified range. The ray trace detects blocks in the player's world considering custom bounding boxes when relevant.
      Parameters:
      player - the player from whose perspective the ray trace is performed
      range - the maximum distance the ray trace will travel
      Returns:
      a RayTraceResult containing information about the hit block and location, or null if no block was hit