Class VeinMinerManager

java.lang.Object
wtf.choco.veinminer.manager.VeinMinerManager

public final class VeinMinerManager extends Object
A manager for VeinMiner's general configurable values.
  • Constructor Details

    • VeinMinerManager

      public VeinMinerManager(@NotNull @NotNull VeinMinerServer veinMiner)
      Construct a new VeinMinerManager.
      Parameters:
      veinMiner - the vein miner server instance
  • Method Details

    • setGlobalBlockList

      public void setGlobalBlockList(@NotNull @NotNull BlockList blockList)
      Set the global BlockList.

      Values in this BlockList should be breakable by all categories.

      Parameters:
      blockList - the block list to set
    • getGlobalBlockList

      @NotNull public @NotNull BlockList getGlobalBlockList()
      Get the global BlockList.

      Values in this BlockList should be breakable by all categories.

      Returns:
      the global block list
    • setGlobalConfig

      public void setGlobalConfig(@NotNull @NotNull VeinMiningConfig config)
      Set the global VeinMiningConfig.

      Values in this config should be used as the default unless otherwise specified.

      Parameters:
      config - the config to set
    • getGlobalConfig

      @NotNull public @NotNull VeinMiningConfig getGlobalConfig()
      Get the global VeinMiningConfig.

      Values in this config should be used as the default unless otherwise specified.

      Returns:
      the global config
    • isDisabledGameMode

      public boolean isDisabledGameMode(@NotNull @NotNull GameMode gameMode)
      Check whether or not the given GameMode is disabled.
      Parameters:
      gameMode - the game mode to check
      Returns:
      true if disabled, false otherwise
    • setDisabledGameModes

      public void setDisabledGameModes(@NotNull @NotNull Collection<GameMode> gameModes)
      Set the disabled GameModes.
      Parameters:
      gameModes - the game modes to disable
    • getDisabledGameModes

      @NotNull public @NotNull @UnmodifiableView Set<GameMode> getDisabledGameModes()
      Get an unmodifiable Set of all disabled GameModes.
      Returns:
      all disabled game modes
    • getAllVeinMineableBlocks

      @NotNull public @NotNull BlockList getAllVeinMineableBlocks()
      Get a BlockList of all VeinMinerBlocks vein mineable in any category.
      Returns:
      a BlockList containing the blocks of all categories and the global BlockList
    • isVeinMineable

      public boolean isVeinMineable(@NotNull @NotNull BlockState state, @NotNull @NotNull VeinMinerToolCategory category)
      Check whether or not the given BlockState can be destroyed using vein miner under the given VeinMinerToolCategory.

      Convenience method to check both the category's BlockList, as well as the global BlockList.

      Parameters:
      state - the state to check
      category - the category to check
      Returns:
      true if the state is vein mineable, false otherwise
    • isVeinMineable

      public boolean isVeinMineable(@NotNull @NotNull BlockType type, @NotNull @NotNull VeinMinerToolCategory category)
      Check whether or not the given BlockType can be destroyed using vein miner under the given VeinMinerToolCategory.

      Convenience method to check both the category's BlockList, as well as the global BlockList.

      Parameters:
      type - the type to check
      category - the category to check
      Returns:
      true if the type is vein mineable, false otherwise
    • isVeinMineable

      public boolean isVeinMineable(@NotNull @NotNull BlockState state)
      Check whether or not the given BlockState can be destroyed using vein miner with any category.

      Convenience method to check all BlockLists, including the global BlockList.

      Parameters:
      state - the state to check
      Returns:
      true if the state is vein mineable, false otherwise
    • isVeinMineable

      public boolean isVeinMineable(@NotNull @NotNull BlockType type)
      Check whether or not the given BlockType can be destroyed using vein miner with any category.

      Convenience method to check all BlockLists, including the global BlockList.

      Parameters:
      type - the type to check
      Returns:
      true if the type is vein mineable, false otherwise
    • getVeinMinerBlock

      @Nullable public @Nullable VeinMinerBlock getVeinMinerBlock(@NotNull @NotNull BlockState state, @NotNull @NotNull VeinMinerToolCategory category)
      Get the VeinMinerBlock instance from the provided VeinMinerToolCategory's BlockList that matches the given BlockState.
      Parameters:
      state - the state whose matching VeinMinerBlock instance to get
      category - the category whose BlockList from which the instance should be fetched
      Returns:
      the matching VeinMinerBlock, or null if none exists
    • addAlias

      public boolean addAlias(@NotNull @NotNull BlockList blockList)
      Add a new alias BlockList.
      Parameters:
      blockList - the list of blocks in this alias
      Returns:
      true if the alias was added, false if it was already added
    • removeAlias

      public boolean removeAlias(@NotNull @NotNull BlockList blockList)
      Remove an alias BlockList.
      Parameters:
      blockList - the alias block list to remove
      Returns:
      true if the alias was removed, false if it was not already added
    • removeAliasContaining

      @Nullable public @Nullable BlockList removeAliasContaining(@NotNull @NotNull VeinMinerBlock block)
      Remove an alias that contains the given VeinMinerBlock.
      Parameters:
      block - the block
      Returns:
      the removed alias block list, or null if none contained the block
    • getAlias

      @Nullable public @Nullable BlockList getAlias(@NotNull @NotNull VeinMinerBlock block)
      Get an alias BlockList that contains the given VeinMinerBlock.
      Parameters:
      block - the block
      Returns:
      the alias block list to which the block belongs
    • clear

      public void clear()
      Clear values stored in this VeinMinerManager (excluding the getGlobalConfig()).