Record Class PaperItemBehavior.Use

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.paper.PaperItemBehavior.Use
Record Components:
player - who clicked
item - the item in the main hand (the live stack: changing it changes the player's item)
block - the block clicked, null in the air
face - the face clicked, null in the air
sneaking - whether the player sneaks
Enclosing class:
PaperItemBehavior

public static record PaperItemBehavior.Use(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @Nullable org.bukkit.block.Block block, @Nullable org.bukkit.block.BlockFace face, boolean sneaking) extends Record
A right-click with the item.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Use(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @Nullable org.bukkit.block.Block block, @Nullable org.bukkit.block.BlockFace face, boolean sneaking)
    Creates an instance of a Use record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable org.bukkit.block.Block
    Returns the value of the block record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @Nullable org.bukkit.block.BlockFace
    Returns the value of the face record component.
    final int
    Returns a hash code value for this object.
    @NotNull org.bukkit.inventory.ItemStack
    Returns the value of the item record component.
    boolean
     
    @NotNull org.bukkit.entity.Player
    Returns the value of the player record component.
    boolean
    Returns the value of the sneaking record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Use

      public Use(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @Nullable @Nullable org.bukkit.block.Block block, @Nullable @Nullable org.bukkit.block.BlockFace face, boolean sneaking)
      Creates an instance of a Use record class.
      Parameters:
      player - the value for the player record component
      item - the value for the item record component
      block - the value for the block record component
      face - the value for the face record component
      sneaking - the value for the sneaking record component
  • Method Details

    • onBlock

      public boolean onBlock()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • player

      @NotNull public @NotNull org.bukkit.entity.Player player()
      Returns the value of the player record component.
      Returns:
      the value of the player record component
    • item

      @NotNull public @NotNull org.bukkit.inventory.ItemStack item()
      Returns the value of the item record component.
      Returns:
      the value of the item record component
    • block

      @Nullable public @Nullable org.bukkit.block.Block block()
      Returns the value of the block record component.
      Returns:
      the value of the block record component
    • face

      @Nullable public @Nullable org.bukkit.block.BlockFace face()
      Returns the value of the face record component.
      Returns:
      the value of the face record component
    • sneaking

      public boolean sneaking()
      Returns the value of the sneaking record component.
      Returns:
      the value of the sneaking record component