Klasse PlayerHitObjectEvent

Alle implementierten Schnittstellen:
Cancellable

public final class PlayerHitObjectEvent extends PlayerObjectEvent
Called when a player hits an object (e.g furniture, doors, lamps etc).
Example: Destroy object after a single hit
1@EventMethod
2public void onObjectHit(PlayerObjectHitEvent event){
3 //Call "removeObject()" on the "World" object. Retrieve typeID and position coordinates from the event
4 world.removeObject(event.getObjectTypeID(), event.getObjectPositionX(), event.getObjectPositionY(), event.getObjectPositionZ());
5}
Siehe auch:
  • Methodendetails

    • getDamage

      public short getDamage()
      Gets the amount of damage the player causes by hitting the object.
      Gibt zurück:
      the amount of damage dealt with this hit.
    • setDamage

      public void setDamage(short damage)
      Sets the amount of damage the player should inflict with this hit.
      Parameter:
      damage - the new amount of damage.
    • getHitPosition

      public Vector3f getHitPosition()
      Gets the world coordinates where the object was hit exactly.
      Gibt zurück:
      coordinates where the object was hit.
    • getObject

      public ObjectElement getObject()
      Beschreibung aus Klasse kopiert: PlayerObjectEvent
      Gets the object element.
      Setzt außer Kraft:
      getObject in Klasse PlayerObjectEvent
      Gibt zurück:
      the object element.