🎆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. BreakPlayer#startMining(Block block, double secondsBlockShouldTakeToBreak, boolean dropVanillaBlock);

    2. BreakPlayer#stopMiningAndResetAnimation();

Example:

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).

Last updated