java.lang.Object
nl.sbdeveloper.vehiclesplus.api.vehicles.parts.Part
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
EquipablePart, Seat

public abstract class Part extends Object implements Cloneable
The Part of a vehicle.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.bukkit.entity.ArmorStand
    The stand of the part.
    protected int
    The rotation offset.
    protected double
    The x-offset
    protected double
    The y-offset
    protected double
    The z-offset
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Part(double xOffset, double yOffset, double zOffset)
    Construct a new Part.
    Part(double xOffset, double yOffset, double zOffset, int rotationOffset)
    Construct a new Part.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Location
    applyExtraOffset(org.bukkit.Location loc)
    Override this method to apply extra offset.
    abstract String
    Get the part as string, for the info command.
    protected boolean
     
     
    void
    Despawn the stand for this part.
    boolean
     
    org.bukkit.entity.ArmorStand
    The stand of the part.
    Retrieves the DrivableVehicle of which this part is a part
    abstract org.bukkit.inventory.ItemStack
    The Configuration and Addon GUI will call this method to get the item to display.
    int
    The rotation offset.
    double
    The x-offset
    double
    The y-offset
    double
    The z-offset
    int
     
    boolean
    Is this part added to the vehicle, or not?
    boolean
    Check if the part is spawned.
    void
    refresh(org.bukkit.Location center)
    Refresh the location of the part, based on the center location.
    void
    setAddon(boolean isAddon)
    Is this part added to the vehicle, or not?
    void
    setRotationOffset(int rotationOffset)
    The rotation offset.
    void
    setXOffset(double xOffset)
    The x-offset
    void
    setYOffset(double yOffset)
    The y-offset
    void
    setZOffset(double zOffset)
    The z-offset
    void
    spawnStand(org.bukkit.Location base, Vehicle owningVehicle, boolean persistent)
    Spawn the stand for this part.
     

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • xOffset

      protected double xOffset
      The x-offset
    • yOffset

      protected double yOffset
      The y-offset
    • zOffset

      protected double zOffset
      The z-offset
    • rotationOffset

      protected int rotationOffset
      The rotation offset.
    • holder

      protected org.bukkit.entity.ArmorStand holder
      The stand of the part. Spawned if not-null.
  • Constructor Details

    • Part

      public Part(double xOffset, double yOffset, double zOffset)
      Construct a new Part.
      Parameters:
      xOffset - The x-offset
      yOffset - The y-offset
      zOffset - The z-offset
    • Part

      public Part(double xOffset, double yOffset, double zOffset, int rotationOffset)
      Construct a new Part.
      Parameters:
      xOffset - The x-offset
      yOffset - The y-offset
      zOffset - The z-offset
      rotationOffset - The rotation offset
    • Part

      public Part()
  • Method Details

    • spawnStand

      public void spawnStand(org.bukkit.Location base, Vehicle owningVehicle, boolean persistent)
      Spawn the stand for this part.
      Parameters:
      base - The base location, where the offset will be applied on.
      owningVehicle - The vehicle that owns this part.
      persistent - If the stand should be persistent.
    • despawnStand

      public void despawnStand()
      Despawn the stand for this part.
    • getOwningVehicle

      public Optional<SpawnedVehicle> getOwningVehicle()
      Retrieves the DrivableVehicle of which this part is a part
      Returns:
      The found DrivableVehicle
      Throws:
      IllegalStateException - if the vehicle can't be found
    • isSpawned

      public boolean isSpawned()
      Check if the part is spawned.
      Returns:
      True if spawned, false if not.
    • applyExtraOffset

      public org.bukkit.Location applyExtraOffset(org.bukkit.Location loc)
      Override this method to apply extra offset.
      Parameters:
      loc - The input location.
      Returns:
      The output location, with the extra offset applied.
    • refresh

      public void refresh(org.bukkit.Location center)
      Refresh the location of the part, based on the center location. This method will apply the offset to the center location, and teleport the holder to that location.
      Parameters:
      center - The center location.
    • getPartGUIItem

      public abstract org.bukkit.inventory.ItemStack getPartGUIItem()
      The Configuration and Addon GUI will call this method to get the item to display.
      Returns:
      The item to display.
    • asString

      public abstract String asString()
      Get the part as string, for the info command.
      Returns:
      The part as string.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public Part clone()
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getXOffset

      public double getXOffset()
      The x-offset
    • setXOffset

      public void setXOffset(double xOffset)
      The x-offset
    • getYOffset

      public double getYOffset()
      The y-offset
    • setYOffset

      public void setYOffset(double yOffset)
      The y-offset
    • getZOffset

      public double getZOffset()
      The z-offset
    • setZOffset

      public void setZOffset(double zOffset)
      The z-offset
    • getRotationOffset

      public int getRotationOffset()
      The rotation offset.
    • setRotationOffset

      public void setRotationOffset(int rotationOffset)
      The rotation offset.
    • getHolder

      public org.bukkit.entity.ArmorStand getHolder()
      The stand of the part. Spawned if not-null.
    • isAddon

      public boolean isAddon()
      Is this part added to the vehicle, or not?
    • setAddon

      public void setAddon(boolean isAddon)
      Is this part added to the vehicle, or not?