Class Part
java.lang.Object
nl.sbdeveloper.vehiclesplus.api.vehicles.parts.Part
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
EquipablePart
,Seat
The Part of a vehicle.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.bukkit.entity.ArmorStand
The stand of the part.protected int
The rotation offset.protected double
The x-offsetprotected double
The y-offsetprotected double
The z-offset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.Location
applyExtraOffset
(org.bukkit.Location loc) Override this method to apply extra offset.abstract String
asString()
Get the part as string, for the info command.protected boolean
clone()
void
Despawn the stand for this part.boolean
org.bukkit.entity.ArmorStand
The stand of the part.Retrieves theDrivableVehicle
of which this part is a partabstract 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-offsetdouble
The y-offsetdouble
The z-offsetint
hashCode()
boolean
isAddon()
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-offsetvoid
setYOffset
(double yOffset) The y-offsetvoid
setZOffset
(double zOffset) The z-offsetvoid
spawnStand
(org.bukkit.Location base, Vehicle owningVehicle, boolean persistent) Spawn the stand for this part.toString()
-
Field Details
-
xOffset
protected double xOffsetThe x-offset -
yOffset
protected double yOffsetThe y-offset -
zOffset
protected double zOffsetThe z-offset -
rotationOffset
protected int rotationOffsetThe rotation offset. -
holder
protected org.bukkit.entity.ArmorStand holderThe 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-offsetyOffset
- The y-offsetzOffset
- The z-offset
-
Part
public Part(double xOffset, double yOffset, double zOffset, int rotationOffset) Construct a new Part.- Parameters:
xOffset
- The x-offsetyOffset
- The y-offsetzOffset
- The z-offsetrotationOffset
- The rotation offset
-
Part
public Part()
-
-
Method Details
-
spawnStand
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
Retrieves theDrivableVehicle
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
Get the part as string, for the info command.- Returns:
- The part as string.
-
toString
-
clone
-
equals
-
canEqual
-
hashCode
public int hashCode() -
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?
-