Package valorless.rarespawns.events
Class DropsMultiplierEvent
java.lang.Object
valorless.rarespawns.events.DropsMultiplierEvent
- All Implemented Interfaces:
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.bukkit.inventory.ItemStack> getShearDrops(org.bukkit.entity.Entity entity) Returns vanilla-like shear drops for supported entity types.static voidinit()Registers this listener with the Bukkit plugin manager.static booleanisCrop(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.voidonBlockDropItem(org.bukkit.event.block.BlockDropItemEvent event) Multiplies natural item drops from crop blocks when broken by a player holding a rare item.voidonPlayerHarvestBlock(org.bukkit.event.player.PlayerHarvestBlockEvent event) Multiplies harvested item drops from crop blocks for players holding a rare item.voidonPlayerShearEntity(org.bukkit.event.player.PlayerShearEntityEvent event) Multiplies shear drops (sheep wool, bogged mushrooms) for players holding a rare item.static org.bukkit.MaterialwoolFromColor(org.bukkit.DyeColor color) Maps a DyeColor to the corresponding wool Material, falling back to white.
-
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
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 stackmultiplier- 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
-