> For the complete documentation index, see [llms.txt](https://dev.vanixmc.com/blockhardness-library/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.vanixmc.com/blockhardness-library/methods-and-events.md).

# Methods And Events

## Methods

All the methods available to you are found in the BreakPlayer class, so you'll always need to get the BreakPlayer before accessing any methods.

To do so, you'll need to:

1. Get an instance of the main class (plugin) from the server plugin manager. Get the breakRegistry using the method in the main class
2. Use the getBreakPlayerRegistry method to get the breakPlayerRegistry
   1. Use method breakPlayerRegistry#getBreakPlayer(Player player) to get a break player from a bukkit player. This method returns an Optional\<BreakPlayer>.
3. Now that you know how to get a BreakPlayer, you can use the methods:
   1. <mark style="color:purple;">**BreakPlayer#startMining(Block block, double secondsBlockShouldTakeToBreak, boolean dropVanillaBlock);**</mark>
   2. <mark style="color:purple;">**BreakPlayer#stopMiningAndResetAnimation();**</mark>

**Example:**

```java
BlockHardnessPlugin blockHardness = (BlockHardnessPlugin) CustomDrops.getInstance()
                .getServer().getPluginManager().getPlugin("BlockHardness");
                
blockHardness.getBreakPlayerRegistry().getBreakPlayer(player)
                .ifPresent(breakPlayer -> breakPlayer.startMining(block,
                                finalBreakSpeed, false));
```

## Events

BlockHardnessBlockInteractEvent (has everything that a block break event has).

CustomHardnessBlockBreakEvent (has everything that a block break event has).
