Klasse PlayerChangeObjectStatusEvent

Alle implementierten Schnittstellen:
Cancellable

public final class PlayerChangeObjectStatusEvent extends PlayerObjectEvent
Called when the player changes the status of an object. For example, when someone opens a door (usually status 0 == closed, status 1 == opened), or turns on a furnace etc.
Example: If a player opens a door, an explosion will be triggered
1@EventMethod
2public void onPlayerChangeObjectStatusEvent(PlayerChangeObjectStatusEvent event){
3 //Get the object
4 ObjectElement o = event.getObject();
5
6 //Get the object definition
7 Objects.ObjectDefiniton definition = o.getDefinition();
8
9 //The definition enables you to find out if the object is a door
10 if(definition.type == Objects.Type.Door){
11 //The door is booby-trapped: we will trigger an explosion
12 World.triggerExplosion(o.getWorldPosition(), true, true);
13 }
14}
  • Methodendetails

    • getOldStatus

      public byte getOldStatus()
    • getNewStatus

      public byte getNewStatus()
      Gets the new object status.
      Gibt zurück:
      the new status.
    • setNewStatus

      public void setNewStatus(byte status)
      Sets the new object status.
      Parameter:
      status - the new status you want to set.
    • 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.