Class AlgorithmConfig

java.lang.Object
wtf.choco.veinminer.data.AlgorithmConfig
All Implemented Interfaces:
Cloneable

public class AlgorithmConfig
extends Object
implements Cloneable
Represents various configurable options for the vein miner algorithm.
Author:
Parker Hawke - Choco
  • Constructor Summary

    Constructors 
    Constructor Description
    AlgorithmConfig()
    Construct an AlgorithmConfig with hard-coded default values.
    AlgorithmConfig​(@NotNull org.bukkit.configuration.ConfigurationSection section)
    Construct an AlgorithmConfig using values supplied from the given configuration section.
    AlgorithmConfig​(@NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable AlgorithmConfig defaultValues)
    Construct an AlgorithmConfig using values supplied from the given configuration section and using the provided AlgorithmConfig as a default fallback if values are not present in the configuration section.
    AlgorithmConfig​(@NotNull AlgorithmConfig config)
    Construct an AlgorithmConfig using values supplied from the given algorithm config.
  • Method Summary

    Modifier and Type Method Description
    AlgorithmConfig clone()  
    @NotNull AlgorithmConfig cost​(double cost)
    Set the amount of money required to vein mine.
    @NotNull AlgorithmConfig disabledWorld​(@NotNull org.bukkit.World world)
    Add a world in which vein miner should be disabled.
    boolean equals​(Object object)  
    double getCost()
    Get the economic cost.
    int getMaxVeinSize()
    Get the maximum vein size.
    int hashCode()  
    @NotNull AlgorithmConfig includeEdges​(boolean includeEdges)
    Set whether or not vein miner should search for vein mineable blocks along the farthest edges of a block (i.e.
    boolean includesEdges()
    Check whether or not vein miner should include edges.
    boolean isDisabledWorld​(@NotNull org.bukkit.World world)
    Check whether or not vein miner is disabled in the specified world.
    boolean isRepairFriendly()
    Get whether or not vein miner should be repair-friendly.
    @NotNull AlgorithmConfig maxVeinSize​(int maxVeinSize)
    Set the maximum vein size.
    void readUnsafe​(@NotNull Map<String,​Object> raw)
    Deprecated.
    not set for removal but AVOID AT ALL COSTS.
    @NotNull AlgorithmConfig repairFriendly​(boolean friendly)
    Set whether or not vein miner should be repair-friendly.
    @NotNull AlgorithmConfig undisableWorld​(@NotNull org.bukkit.World world)
    Remove a world in which vein miner is disabled.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AlgorithmConfig

      public AlgorithmConfig​(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable @Nullable AlgorithmConfig defaultValues)
      Construct an AlgorithmConfig using values supplied from the given configuration section and using the provided AlgorithmConfig as a default fallback if values are not present in the configuration section.
      Parameters:
      section - the section from which to read values
      defaultValues - the config from which to pull default values
    • AlgorithmConfig

      public AlgorithmConfig​(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section)
      Construct an AlgorithmConfig using values supplied from the given configuration section.
      Parameters:
      section - the section from which to read values
    • AlgorithmConfig

      public AlgorithmConfig​(@NotNull @NotNull AlgorithmConfig config)
      Construct an AlgorithmConfig using values supplied from the given algorithm config.
      Parameters:
      config - the configuration from which to read values
      See Also:
      clone()
    • AlgorithmConfig

      public AlgorithmConfig()
      Construct an AlgorithmConfig with hard-coded default values.
  • Method Details

    • repairFriendly

      @NotNull public @NotNull AlgorithmConfig repairFriendly​(boolean friendly)
      Set whether or not vein miner should be repair-friendly. If true, vein miner will cease execution before the tool has lost all its durability allowing the user to repair their tool before it gets broken. If false, vein miner will cease execution after the tool has broken.
      Parameters:
      friendly - the repair-friendly state
      Returns:
      this instance. Allows for chained method calls
    • isRepairFriendly

      public boolean isRepairFriendly()
      Get whether or not vein miner should be repair-friendly. See repairFriendly(boolean).
      Returns:
      true if repair-friendly, false otherwise
    • includeEdges

      @NotNull public @NotNull AlgorithmConfig includeEdges​(boolean includeEdges)
      Set whether or not vein miner should search for vein mineable blocks along the farthest edges of a block (i.e. north north east, north north west, etc.).
      Parameters:
      includeEdges - whether to include edges
      Returns:
      this instance. Allows for chained method calls
    • includesEdges

      public boolean includesEdges()
      Check whether or not vein miner should include edges. See includesEdges().
      Returns:
      true if includes edges, false otherwise
    • maxVeinSize

      @NotNull public @NotNull AlgorithmConfig maxVeinSize​(int maxVeinSize)
      Set the maximum vein size.
      Parameters:
      maxVeinSize - the maximum vein size
      Returns:
      this instance. Allows for chained method calls
    • getMaxVeinSize

      public int getMaxVeinSize()
      Get the maximum vein size.
      Returns:
      the maximum vein size
    • cost

      @NotNull public @NotNull AlgorithmConfig cost​(double cost)
      Set the amount of money required to vein mine. Note, this feature requires Vault and an economy plugin, else it is ignored.
      Parameters:
      cost - the cost
      Returns:
      this instance. Allows for chained method calls
    • getCost

      public double getCost()
      Get the economic cost.
      Returns:
      the cost
    • disabledWorld

      @NotNull public @NotNull AlgorithmConfig disabledWorld​(@NotNull @NotNull org.bukkit.World world)
      Add a world in which vein miner should be disabled.
      Parameters:
      world - the world in which to disable vein miner
      Returns:
      this instance. Allows for chained method calls
    • undisableWorld

      @NotNull public @NotNull AlgorithmConfig undisableWorld​(@NotNull @NotNull org.bukkit.World world)
      Remove a world in which vein miner is disabled. Vein miner will be usable again.
      Parameters:
      world - the world in which to enabled vein miner
      Returns:
      this instance. Allows for chained method calls
    • isDisabledWorld

      public boolean isDisabledWorld​(@NotNull @NotNull org.bukkit.World world)
      Check whether or not vein miner is disabled in the specified world.
      Parameters:
      world - the world to check
      Returns:
      true if disabled, false otherwise
    • readUnsafe

      @Deprecated public void readUnsafe​(@NotNull @NotNull Map<String,​Object> raw)
      Deprecated.
      not set for removal but AVOID AT ALL COSTS. Constructors and builder methods should be the preferred approach to reading configured values.
      Read configured values from a raw Map. This is not a recommended means of reading data and exists solely for internal use.
      Parameters:
      raw - the raw data from which to read configured values
    • clone

      public AlgorithmConfig clone()
    • hashCode

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

      public boolean equals​(Object object)
      Overrides:
      equals in class Object