Class DropsMultiplierEvent

java.lang.Object
valorless.rarespawns.events.DropsMultiplierEvent
All Implemented Interfaces:
org.bukkit.event.Listener

public class DropsMultiplierEvent extends Object implements org.bukkit.event.Listener
Multiplies drops from crops and shearing when the player uses a RareSpawns item.

Listens to:

  • BlockDropItemEvent – crop blocks broken by player
  • PlayerHarvestBlockEvent – block harvesting mechanics
  • PlayerShearEntityEvent – sheep/bogged shearing
For recognized rare items, it reads the cropsMultiplier from ItemData and adjusts the resulting drops accordingly.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<org.bukkit.inventory.ItemStack>
    getShearDrops(org.bukkit.entity.Entity entity)
    Returns vanilla-like shear drops for supported entity types.
    static void
    Registers this listener with the Bukkit plugin manager.
    static boolean
    isCrop(org.bukkit.block.Block block)
    Returns whether the given block type is treated as a crop for multiplier purposes.
    static List<org.bukkit.inventory.ItemStack>
    multiplyDrop(org.bukkit.inventory.ItemStack original, Double multiplier)
    Multiplies an ItemStack's amount by a factor and splits into valid stack sizes.
    void
    onBlockDropItem(org.bukkit.event.block.BlockDropItemEvent event)
    Multiplies natural item drops from crop blocks when broken by a player holding a rare item.
    void
    onPlayerHarvestBlock(org.bukkit.event.player.PlayerHarvestBlockEvent event)
    Multiplies harvested item drops from crop blocks for players holding a rare item.
    void
    onPlayerShearEntity(org.bukkit.event.player.PlayerShearEntityEvent event)
    Multiplies shear drops (sheep wool, bogged mushrooms) for players holding a rare item.
    static org.bukkit.Material
    woolFromColor(org.bukkit.DyeColor color)
    Maps a DyeColor to the corresponding wool Material, falling back to white.

    Methods inherited from class java.lang.Object

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

    • DropsMultiplierEvent

      public DropsMultiplierEvent()
  • Method Details

    • init

      public static void init()
      Registers this listener with the Bukkit plugin manager.
    • onBlockDropItem

      public void onBlockDropItem(org.bukkit.event.block.BlockDropItemEvent event)
      Multiplies natural item drops from crop blocks when broken by a player holding a rare item.
      Parameters:
      event - the block drop event
    • onPlayerHarvestBlock

      public void onPlayerHarvestBlock(org.bukkit.event.player.PlayerHarvestBlockEvent event)
      Multiplies harvested item drops from crop blocks for players holding a rare item.
      Parameters:
      event - the harvest block event
    • onPlayerShearEntity

      public void onPlayerShearEntity(org.bukkit.event.player.PlayerShearEntityEvent event)
      Multiplies shear drops (sheep wool, bogged mushrooms) for players holding a rare item.
      Parameters:
      event - the shear entity event
    • getShearDrops

      public static List<org.bukkit.inventory.ItemStack> getShearDrops(org.bukkit.entity.Entity entity)
      Returns vanilla-like shear drops for supported entity types. Currently supports sheep (1–3 wool, color-based) and bogged (mushrooms).
      Parameters:
      entity - the sheared entity
      Returns:
      a list of drops for the entity type (possibly empty)
    • woolFromColor

      public static org.bukkit.Material woolFromColor(org.bukkit.DyeColor color)
      Maps a DyeColor to the corresponding wool Material, falling back to white.
      Parameters:
      color - the sheep wool color
      Returns:
      the matching Material._WOOL, or WHITE_WOOL on error
    • multiplyDrop

      public static List<org.bukkit.inventory.ItemStack> multiplyDrop(org.bukkit.inventory.ItemStack original, Double multiplier)
      Multiplies an ItemStack's amount by a factor and splits into valid stack sizes.
      Parameters:
      original - the original stack
      multiplier - the factor to multiply by
      Returns:
      a list of stacks whose total amount equals original.amount * multiplier
    • isCrop

      public static boolean isCrop(org.bukkit.block.Block block)
      Returns whether the given block type is treated as a crop for multiplier purposes. Extend this switch with additional plants if support is needed.
      Parameters:
      block - the block to test
      Returns:
      true when considered a crop; false otherwise