Class SellStep

java.lang.Object
me.fami6xx.rpuniverse.core.jobs.SellStep

public class SellStep extends Object
Represents a sell step where players can sell items at a specific location.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SellStep​(UUID jobUUID, org.bukkit.Location location, org.bukkit.inventory.ItemStack itemToSell, double itemValue, int timeToSell, int maxSellAmount, double playerPercentage, double jobPercentage, String name, String description)
    Constructor for creating a new SellStep.
  • Method Summary

    Modifier and Type
    Method
    Description
    static SellStep
    fromJsonObject​(com.google.gson.JsonObject jsonObject)
    Creates a SellStep from its JSON object.
    static SellStep
    Converts a string representation of a SellStep object into an actual SellStep object.
    Gets the description of the sell step.
    org.bukkit.inventory.ItemStack
    Gets the item that players can sell.
    double
    Gets the value of the item (per unit).
    double
    Gets the percentage of the sale price that goes to the job.
    Gets the UUID of the job this SellStep belongs to.
    org.bukkit.Location
    Gets the location where the sell step is performed.
    int
    Gets the maximum number of items a player can sell at once.
    Gets the name of the sell step.
    double
    Gets the percentage of the sale price that goes to the player.
    int
    Gets the time it takes to sell the item (in ticks).
    Gets the UUID of this SellStep.
    void
    setDescription​(String description)
    Sets the description of the sell step.
    void
    setItemToSell​(org.bukkit.inventory.ItemStack itemToSell)
    Sets the item that players can sell.
    void
    setItemValue​(double itemValue)
    Sets the value of the item (per unit).
    void
    setJobPercentage​(double jobPercentage)
    Sets the percentage of the sale price that goes to the job.
    void
    setJobUUID​(UUID jobUUID)
    Sets the UUID of the job this SellStep belongs to.
    void
    setLocation​(org.bukkit.Location location)
    Sets the location where the sell step is performed.
    void
    setMaxSellAmount​(int maxSellAmount)
    Sets the maximum number of items a player can sell at once.
    void
    setName​(String name)
    Sets the name of the sell step.
    void
    setPlayerPercentage​(double playerPercentage)
    Sets the percentage of the sale price that goes to the player.
    void
    setTimeToSell​(int timeToSell)
    Sets the time it takes to sell the item (in ticks).
    com.google.gson.JsonObject
    Converts this SellStep to a JSON object.
    Converts this SellStep to a YAML string representation.
    void
    Validates that the sum of playerPercentage and jobPercentage is 100%.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SellStep

      public SellStep(@Nonnull UUID jobUUID, @Nonnull org.bukkit.Location location, @Nonnull org.bukkit.inventory.ItemStack itemToSell, double itemValue, int timeToSell, int maxSellAmount, double playerPercentage, double jobPercentage, @Nonnull String name, @Nonnull String description)
      Constructor for creating a new SellStep.
      Parameters:
      jobUUID - The UUID of the job this sell step belongs to.
      location - The location where the sell step is performed.
      itemToSell - The item that players can sell.
      itemValue - The value of the item (per unit).
      timeToSell - The time it takes to sell the item (in ticks).
      maxSellAmount - The maximum number of items a player can sell at once.
      playerPercentage - The percentage of the sale price that goes to the player.
      jobPercentage - The percentage of the sale price that goes to the job.
      name - The name of the sell step.
      description - The description of the sell step.
  • Method Details

    • getUuid

      public UUID getUuid()
      Gets the UUID of this SellStep.
      Returns:
      The UUID of this SellStep.
    • getJobUUID

      public UUID getJobUUID()
      Gets the UUID of the job this SellStep belongs to.
      Returns:
      The UUID of the job.
    • setJobUUID

      public void setJobUUID(@Nonnull UUID jobUUID)
      Sets the UUID of the job this SellStep belongs to.
      Parameters:
      jobUUID - The new UUID of the job.
    • getLocation

      public org.bukkit.Location getLocation()
      Gets the location where the sell step is performed.
      Returns:
      The location of the sell step.
    • setLocation

      public void setLocation(@Nonnull org.bukkit.Location location)
      Sets the location where the sell step is performed.
      Parameters:
      location - The new location of the sell step.
    • getItemToSell

      public org.bukkit.inventory.ItemStack getItemToSell()
      Gets the item that players can sell.
      Returns:
      The item to sell.
    • setItemToSell

      public void setItemToSell(@Nonnull org.bukkit.inventory.ItemStack itemToSell)
      Sets the item that players can sell.
      Parameters:
      itemToSell - The new item to sell.
    • getItemValue

      public double getItemValue()
      Gets the value of the item (per unit).
      Returns:
      The value of the item.
    • setItemValue

      public void setItemValue(double itemValue)
      Sets the value of the item (per unit).
      Parameters:
      itemValue - The new value of the item.
    • getTimeToSell

      public int getTimeToSell()
      Gets the time it takes to sell the item (in ticks).
      Returns:
      The time to sell the item.
    • setTimeToSell

      public void setTimeToSell(int timeToSell)
      Sets the time it takes to sell the item (in ticks).
      Parameters:
      timeToSell - The new time to sell the item.
    • getMaxSellAmount

      public int getMaxSellAmount()
      Gets the maximum number of items a player can sell at once.
      Returns:
      The maximum sell amount.
    • setMaxSellAmount

      public void setMaxSellAmount(int maxSellAmount)
      Sets the maximum number of items a player can sell at once.
      Parameters:
      maxSellAmount - The new maximum sell amount.
    • getPlayerPercentage

      public double getPlayerPercentage()
      Gets the percentage of the sale price that goes to the player.
      Returns:
      The player percentage.
    • setPlayerPercentage

      public void setPlayerPercentage(double playerPercentage)
      Sets the percentage of the sale price that goes to the player.
      Parameters:
      playerPercentage - The new player percentage.
    • getJobPercentage

      public double getJobPercentage()
      Gets the percentage of the sale price that goes to the job.
      Returns:
      The job percentage.
    • setJobPercentage

      public void setJobPercentage(double jobPercentage)
      Sets the percentage of the sale price that goes to the job.
      Parameters:
      jobPercentage - The new job percentage.
    • getName

      public String getName()
      Gets the name of the sell step.
      Returns:
      The name of the sell step.
    • setName

      public void setName(@Nonnull String name)
      Sets the name of the sell step.
      Parameters:
      name - The new name of the sell step.
    • getDescription

      public String getDescription()
      Gets the description of the sell step.
      Returns:
      The description of the sell step.
    • setDescription

      public void setDescription(@Nonnull String description)
      Sets the description of the sell step.
      Parameters:
      description - The new description of the sell step.
    • fromString

      public static SellStep fromString(String s)
      Converts a string representation of a SellStep object into an actual SellStep object.
      Parameters:
      s - The string representation of the SellStep object.
      Returns:
      The SellStep object created from the string representation, or null if an error occurs during parsing.
    • toString

      public String toString()
      Converts this SellStep to a YAML string representation.
      Overrides:
      toString in class Object
      Returns:
      A YAML string representing this SellStep.
    • toJsonObject

      public com.google.gson.JsonObject toJsonObject()
      Converts this SellStep to a JSON object.
      Returns:
      A JsonObject representing this SellStep.
    • fromJsonObject

      public static SellStep fromJsonObject(com.google.gson.JsonObject jsonObject)
      Creates a SellStep from its JSON object.
      Parameters:
      jsonObject - The JSON representation of a SellStep.
      Returns:
      A new SellStep instance populated from the JSON data.
    • validatePercentages

      public void validatePercentages()
      Validates that the sum of playerPercentage and jobPercentage is 100%.
      Throws:
      IllegalArgumentException - if the percentages do not sum to 100%.