Klasse PlayerPlaceConstructionEvent

Alle implementierten Schnittstellen:
Cancellable

public final class PlayerPlaceConstructionEvent extends PlayerConstructionEvent
Called when a player places a construction element.
  • Methodendetails

    • getGlobalIDs

      public long[] getGlobalIDs()
      If the player places multiple construction elements in a row, this method gets the unique, global IDs of all construction elements which are about to be placed. If only a single element is placed, use PlayerConstructionEvent.getGlobalID() instead. To find out if the player only places a single element, check if getTotalCount() returns 1
      Gibt zurück:
      a new array containing all global IDs of the construction elements. If just a single element was placed, the array just contains the global ID of that element.
      Example:
      1@EventMethod
      2public void onPlayerPlaceConstruction(PlayerPlaceConstructionEvent evt) {
      3 //If count is greater than 1, player placed multiple blocks in a row
      4 if (evt.getTotalCount() > 1) {
      5 long[] array = evt.getGlobalIDs(pointer);
      6 System.out.println("Player placed multiple blocks. IDs: " + Arrays.toString(array));
      7 }
      8 //Otherwise player just placed a single block
      9 else {
      10 System.out.println("Player placed single block. ID: " + evt.getGlobalID());
      11 }
      12}
    • setTypeID

      public void setTypeID(byte id)
      Sets the type ID of the construction element.
      Parameter:
      id - the new type ID.
    • setTextureID

      public void setTextureID(int texture)
      Sets the texture of the construction element.
      Parameter:
      texture - the new texture ID. If this is a "poster" construction element, the texture ID is the custom image ID.
    • setPosition

      public void setPosition(Vector3f position)
      Changes the world position of the construction element.
      Parameter:
      position - the new world position of the construction element.
    • setPosition

      public void setPosition(float x, float y, float z)
      Changes the world position of the construction element.
      Parameter:
      x - the new world x position of the construction element.
      y - the new world y position of the construction element.
      z - the new world z position of the construction element.
    • setRotation

      public void setRotation(Quaternion rotation)
      Changes the rotation of the construction element.
      Parameter:
      rotation - the new construction element rotation. Set to null to reset the rotation (Quaternion.IDENTITY).
    • setRotation

      public void setRotation(float pitch, float yaw, float roll)
      Changes the rotation of the construction element.
      Parameter:
      pitch - the new x angle, as euler rotation (pitch).
      yaw - the new y angle, as euler rotation (yaw).
      roll - the new z angle, as euler rotation (roll).
    • setSize

      public void setSize(Vector3f size)
      Changes the size of the construction element.
      Parameter:
      size - the new size (x, y, z, as a Vector3f) of the construction element.
    • setSize

      public void setSize(float x, float y, float z)
      Changes the size of the construction element.
      Parameter:
      x - the new size of the construction element along the x axis.
      y - the new size of the construction element along the y axis.
      z - the new size of the construction element along the z axis.
    • setColor

      public void setColor(int color)
    • getMultiPlaceRowX

      public int getMultiPlaceRowX()
      Gets the amount of additional elements the player wants to place in a row (multi-placement) along the x axis. By default this is 0 (which means that no additional elements are about to placed along x). The value is negative if the direction is along -x
      Gibt zurück:
      amount of extra elements the player wants to place along x. A positive value means that this amount of elements is placed additionally along +x, a negative value means that this amount of elements (abs) if placed additionally along -x
    • getMultiPlaceRowY

      public int getMultiPlaceRowY()
      Gets the amount of additional elements the player wants to place in a row (multi-placement) along the y axis. By default this is 0 (which means that no additional elements are about to placed along y). The value is negative if the direction is along -y
      Gibt zurück:
      amount of extra elements the player wants to place along y. A positive value means that this amount of elements is placed additionally along +y, a negative value means that this amount of elements (abs) if placed additionally along -y
    • getMultiPlaceRowZ

      public int getMultiPlaceRowZ()
      Gets the amount of additional elements the player wants to place in a row (multi-placement) along the z axis. By default this is 0 (which means that no additional elements are about to placed along z). The value is negative if the direction is along -z
      Gibt zurück:
      amount of extra elements the player wants to place along z. A positive value means that this amount of elements is placed additionally along +z, a negative value means that this amount of elements (abs) if placed additionally along -z
    • getMultiPlaceGap

      public float getMultiPlaceGap()
      If multiple elements are about to be placed in a row (multi-placement), this determines the gap between the elements.
      Gibt zurück:
      the gap between elements when placing multiple elements in a row.
    • setMultiPlaceGap

      public void setMultiPlaceGap(float gap)
      Sets the gap between elements if multiple elements are about to be placed in a row (multi-placement).
      Parameter:
      gap - the gap between multiple elements.
    • getTotalCount

      public int getTotalCount()
      Gets the total amount of elements the player is about to place.
      Gibt zurück:
      the number of elements the player wants to place. Returns 1 if the player wants to place a single element only, or a higher value when placing multiple elements in a row.