Class PlantEvent

java.lang.Object
org.bukkit.event.Event
simplexity.scythe.events.PlantEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlantEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlantEvent(org.bukkit.entity.Player player, org.bukkit.block.Block block, org.bukkit.block.data.BlockData originialBlockData)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.block.Block
    Returns the block involved in the event.
    org.bukkit.Location
    Returns the location of the block involved in the event.
    org.bukkit.Material
    Returns the material of the block involved in the event.
    static org.bukkit.event.HandlerList
    Returns the handler list for the PlantEvent.
    @NotNull org.bukkit.event.HandlerList
    Returns the handler list for the PlantEvent.
    org.bukkit.block.data.BlockData
    Returns the original BlockData for the block before replanting.
    org.bukkit.block.data.BlockData
    Returns the BlockData representing the new state of the block after replanting.
    org.bukkit.entity.Player
    Returns the player involved in the event.
    boolean
    Checks if the block is still supported in its current location.
    boolean
    Checks if the event has been cancelled.
    boolean
    Checks if CoreProtect is enabled on the server.
    boolean
    Checks if the player has permission to replant.
    void
    Performs checks to ensure the block is still supported and the player has permission to replant.
    void
    Replants the crop by setting the block data to the first growth stage
    Logs the placement with CoreProtect if enabled.
    void
    setCancelled(boolean cancel)
    Sets the cancelled state of the event.
    void
    setPlantedBlockData(org.bukkit.block.data.BlockData plantedBlockData)
    Sets the BlockData representing the new state of the block after replanting.
    void
    Sets the block data to the first growth stage.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

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

    • PlantEvent

      public PlantEvent(org.bukkit.entity.Player player, org.bukkit.block.Block block, org.bukkit.block.data.BlockData originialBlockData)
  • Method Details

    • prePlantChecks

      public void prePlantChecks()
      Performs checks to ensure the block is still supported and the player has permission to replant. If either check fails, the event is cancelled.
    • replantCrop

      public void replantCrop()
      Replants the crop by setting the block data to the first growth stage
      Logs the placement with CoreProtect if enabled.
    • setToFirstGrowthStage

      public void setToFirstGrowthStage()
      Sets the block data to the first growth stage.
      Only applies to blocks with Ageable block data.
    • isBlockStillSupported

      public boolean isBlockStillSupported()
      Checks if the block is still supported in its current location.
      True if the block is still supported, false otherwise
      Returns:
      boolean
    • playerHasPermission

      public boolean playerHasPermission()
      Checks if the player has permission to replant.
      True if the player has permission, false otherwise
      Returns:
      boolean
    • getBlockLocation

      public org.bukkit.Location getBlockLocation()
      Returns the location of the block involved in the event.
      Returns:
      Location
    • getBlockMaterial

      public org.bukkit.Material getBlockMaterial()
      Returns the material of the block involved in the event.
      Returns:
      Material
    • getPlantedBlockData

      public org.bukkit.block.data.BlockData getPlantedBlockData()
      Returns the BlockData representing the new state of the block after replanting.
      Returns:
      BlockData
    • setPlantedBlockData

      public void setPlantedBlockData(org.bukkit.block.data.BlockData plantedBlockData)
      Sets the BlockData representing the new state of the block after replanting.
      Parameters:
      plantedBlockData - BlockData
    • isCoreProtectEnabled

      public boolean isCoreProtectEnabled()
      Checks if CoreProtect is enabled on the server.
      True if CoreProtect is enabled, false otherwise
      Returns:
      boolean
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Returns the handler list for the PlantEvent.
      Returns:
      HandlerList
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Returns the handler list for the PlantEvent.
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      HandlerList
    • isCancelled

      public boolean isCancelled()
      Checks if the event has been cancelled.
      True if the event has been cancelled, false otherwise
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      boolean
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets the cancelled state of the event.
      True to cancel the event, false otherwise
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancel - boolean
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Returns the player involved in the event.
      Returns:
      Player
    • getBlock

      public org.bukkit.block.Block getBlock()
      Returns the block involved in the event.
      Returns:
      Block
    • getOriginialBlockData

      public org.bukkit.block.data.BlockData getOriginialBlockData()
      Returns the original BlockData for the block before replanting.
      Returns:
      BlockData