Class PlayerPlaceObjectEvent

All Implemented Interfaces:
Cancellable

public final class PlayerPlaceObjectEvent extends PlayerObjectEvent
Called when a player places an objects (furniture, doors, lamps, chests etc).
  • Method Details

    • getObject

      protected ObjectElement getObject()
      Note: This function returns null because the object had not yet been created at the time of the event!
      To access information (like position, rotation etc), please check out the other functions of this event
      Overrides:
      getObject in class PlayerObjectEvent
      Returns:
      always null
    • getPosition

      public Vector3f getPosition()
      Gets the world position of the object as a Vector3f.
      Returns:
      the global object position as a Vector3f.
    • getRotation

      public Quaternion getRotation()
      Gets the rotation of the object as a Quaternion.
      Returns:
      the object rotation as a Quaternion.
    • getScale

      public Vector3f getScale()
      Gets the scale factor of the object along the x, y and z axis. By default, it's 1 1 1.
      Returns:
      the object scale factor, as a Vector3f.
    • getColor

      public int getColor()
    • getStatus

      public byte getStatus()
      Gets the current status of the object. The status is only used by some objects, e.g. doors (usually status 0 == closed, status 1 == opened), chests (status only represents the visual state, like doors), furnaces etc.
      Returns:
      the object status.
    • getInfoID

      public long getInfoID()
      Gets the info ID of the object. For regular objects, the info ID is usually -1 (so it's unused), only objects which hold additional information have an info ID (e.g for a chest, the info ID is the global chest ID, for furnaces, it is the global furnace ID etc).
      Returns:
      the object info ID.
    • setColor

      public void setColor(int rgba)
    • setPosition

      public void setPosition(Vector3f position)
      Changes the object world position.
      Parameters:
      position - the new object world position.
    • setPosition

      public void setPosition(float x, float y, float z)
      Changes the object world position.
      Parameters:
      x - the new object world x position.
      y - the new object world y position.
      z - the new object world z position.
    • setRotation

      public void setRotation(Quaternion rotation)
      Changes the object rotation.
      Parameters:
      rotation - the new object rotation. Set to null to reset the rotation (Quaternion.IDENTITY).