Class DoubleOrNothing

All Implemented Interfaces:
org.bukkit.event.Listener

public class DoubleOrNothing extends BaseDropModification
A drop modification event that implements a double-or-nothing mechanic. When active, each block break or entity death has a 50% chance to either: - Double all drops and experience, or - Drop nothing and no experience The outcome is determined randomly but consistently for each block/entity.
  • Constructor Details

    • DoubleOrNothing

      public DoubleOrNothing()
      Constructs a new DoubleOrNothing event with NEGATIVE classification. Initializes the event with the name "doubleOrNothing".
  • Method Details

    • setupDropModifications

      protected void setupDropModifications()
      No setup required for this modification as it doesn't use predefined drops.
      Specified by:
      setupDropModifications in class BaseDropModification
    • onBlockBreak

      public void onBlockBreak(org.bukkit.event.block.BlockBreakEvent event)
      Handles block breaking events by determining and storing the drop outcome. Uses a consistent random seed based on block location and player name. Sets metadata on the block and modifies XP drops accordingly.
      Overrides:
      onBlockBreak in class BaseDropModification
      Parameters:
      event - the block break event
    • handleBlockDrops

      protected boolean handleBlockDrops(org.bukkit.event.block.BlockDropItemEvent event)
      Processes block drops according to the stored outcome. Either doubles all item drops or cancels them entirely.
      Overrides:
      handleBlockDrops in class BaseDropModification
      Parameters:
      event - the block drop item event
      Returns:
      true if drops were modified, false if event was ignored
    • handleEntityDrops

      protected boolean handleEntityDrops(org.bukkit.event.entity.EntityDeathEvent event)
      Processes entity drops with a 50% chance to either double or remove drops. Affects both item drops and experience points.
      Overrides:
      handleEntityDrops in class BaseDropModification
      Parameters:
      event - the entity death event
      Returns:
      true if drops were modified, false if event was ignored
    • execute

      public void execute()
      Executes the double-or-nothing event by registering listeners. Delegates to parent class.
      Overrides:
      execute in class BaseDropModification
    • terminate

      public void terminate()
      Terminates the double-or-nothing event by unregistering listeners. Delegates to parent class.
      Overrides:
      terminate in class BaseDropModification