Class CargoUtils

Object
CargoUtils

public class CargoUtils extends Object
Contains methods for working with cargo and item stacks.
Since:
1.0
Author:
LazyWizard
  • Method Details

    • moveStack

      public static void moveStack(CargoStackAPI stack, CargoAPI to)
      Moves an entire CargoStackAPI from its current location to another CargoAPI.
      Parameters:
      stack - The CargoStackAPI to be moved.
      to - The destination CargoAPI.
      Since:
      1.0
    • moveStack

      public static void moveStack(CargoStackAPI stack, SectorEntityToken to)
      Moves an entire CargoStackAPI from its current location to the CargoAPI of another SectorEntityToken.
      Parameters:
      stack - The CargoStackAPI to be moved.
      to - The destination SectorEntityToken.
      Since:
      1.2
    • moveMothballedShips

      public static void moveMothballedShips(CargoAPI from, CargoAPI to)
      Moves all mothballed FleetMemberAPIs from one CargoAPI to another.
      Parameters:
      from - The CargoAPI to be emptied.
      to - The destination CargoAPI.
      Since:
      1.9
    • moveCargo

      public static void moveCargo(CargoAPI from, CargoAPI to)
      Moves all CargoStackAPIs from one CargoAPI to another.
      Parameters:
      from - The CargoAPI to be emptied.
      to - The destination CargoAPI.
      Since:
      1.0
      See Also:
    • isShipInMothballed

      public static boolean isShipInMothballed(String fleetMemberId, CargoAPI cargo)
      Checks if a cargo contains a specific mothballed ship.
      Parameters:
      fleetMemberId - The fleet member ID of the ship to check. This can be retrieved with ShipAPI.getFleetMemberId() or FleetMemberAPI.getId().
      cargo - The cargo to check for the presence of this ship in.
      Returns:
      true if cargo contains a ship with this ID, false otherwise.
      Since:
      2.0
    • getSpaceTakenByWeapons

      public static float getSpaceTakenByWeapons(CargoAPI cargo)
      Returns the amount of space taken by weapons in a CargoAPI.
      Parameters:
      cargo - The CargoAPI to analyze.
      Returns:
      The amount of space taken by weapons in cargo.
      Since:
      1.0
    • getSpaceTakenByCrew

      public static float getSpaceTakenByCrew(CargoAPI cargo)
      Returns the amount of space taken by crew in a CargoAPI.
      Parameters:
      cargo - The CargoAPI to analyze.
      Returns:
      The amount of space taken by crew in cargo.
      Since:
      1.0
    • getSpaceTakenBySupplies

      public static float getSpaceTakenBySupplies(CargoAPI cargo)
      Returns the amount of space taken by supplies in a CargoAPI.
      Parameters:
      cargo - The CargoAPI to analyze.
      Returns:
      The amount of space taken by supplies in cargo.
      Since:
      1.0
    • getSpaceTakenByFuel

      public static float getSpaceTakenByFuel(CargoAPI cargo)
      Returns the amount of space taken by fuel in a CargoAPI.
      Parameters:
      cargo - The CargoAPI to analyze.
      Returns:
      The amount of space taken by fuel in cargo.
      Since:
      1.0
    • getSpaceTakenByCommodities

      public static float getSpaceTakenByCommodities(CargoAPI cargo)
      Returns the amount of space taken by all commodities in a CargoAPI.
      Parameters:
      cargo - The CargoAPI to analyze.
      Returns:
      The amount of space taken by commodity stacks in cargo.
      Since:
      1.0
    • getSpaceTakenByCargo

      public static float getSpaceTakenByCargo(CargoAPI cargo)
      Returns the amount of space taken by all cargo types in a CargoAPI.
      Parameters:
      cargo - The CargoAPI to analyze.
      Returns:
      The amount of space used in cargo.
      Since:
      1.2