Class WorkstationHighlightEvent

java.lang.Object
org.bukkit.event.Event
simplexity.villagerinfo.events.WorkstationHighlightEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class WorkstationHighlightEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Called when a workstation is going to be highlighted, requires Bukkit Villager object and Bukkit Block object
  • Nested Class Summary

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

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

    Constructors
    Constructor
    Description
    WorkstationHighlightEvent(org.bukkit.entity.Player player, org.bukkit.entity.Villager villager, org.bukkit.NamespacedKey namespacedKey)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds the villager and block display to the map of currently highlighted workstations
    void
    Checks player's output toggle state and sets playerHighlightToggleEnabled
    org.bukkit.entity.BlockDisplay
    Gets the block display entity that was spawned
    byte
    Gets the villager's current switch state 0b for no current workstations highlighted 1b for currently highlighted workstations
    static org.bukkit.event.HandlerList
    Gets the handler list for this evene
    @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this evene
    org.bukkit.Color
    Gets the configured highlight color, and returns the default if there is no found color
    org.bukkit.block.Block
    Gets the villager's workstation block, returns null if there is none found
    boolean
    Checks if player's highlight toggle is shown as enabled
    org.bukkit.entity.Villager
    Gets the villager from this event
    void
    Checks villager PDC switch, checks if workstation exists, summonds block display, sets villager switch on, adds villager and display to map
    boolean
    Gets whether this event has been cancelled
    void
    overridePlayerHighlightToggleEnabled(boolean playerHighlightToggleEnabled)
    Overrides the playerHighlightToggleEnabled value, sets it to a new value regardless of the player's settings
    void
    setBlockLight(int blockLight)
    Sets the blocklight for the block display entity 15 by default
    void
    setCancelled(boolean cancel)
    Sets whether this event should be cancelled
    void
    setDefaultColor(org.bukkit.Color defaultColor)
    Sets default color to be used if no colors load from the main config Color.fromRGB(255,255,255) by default
    void
    setSkyLight(int skyLight)
    Sets the skylight for the block display entity 15 by default
    void
    Sets the villager PDC switch on (1b) signifying that this villager's workstation is currently highlighted
    void
    setXScaleOffset(float xScaleOffset)
    Sets the x scale offset for the block display entity -0.03f by default
    void
    setYScaleOffset(float yScaleOffset)
    Sets the y scale offset for the block display entity -0.03f by default
    void
    setZScaleOffset(float zScaleOffset)
    Sets the z scale offset for the block display entity -0.03f by default
    void
    Summons the block display Uses getJobBlock(), xScaleOffset, yScaleOffset, zScaleOffset, blockLight, skyLight

    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

    • WorkstationHighlightEvent

      public WorkstationHighlightEvent(org.bukkit.entity.Player player, org.bukkit.entity.Villager villager, org.bukkit.NamespacedKey namespacedKey)
  • Method Details

    • isCancelled

      public boolean isCancelled()
      Gets whether this event has been cancelled
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      boolean
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets whether this event should be cancelled
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the handler list for this evene
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      HandlerList
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Gets the handler list for this evene
      Returns:
      HandlerList
    • getVillager

      public org.bukkit.entity.Villager getVillager()
      Gets the villager from this event
      Returns:
      Villager
    • getJobBlock

      public org.bukkit.block.Block getJobBlock()
      Gets the villager's workstation block, returns null if there is none found
      Returns:
      Block
    • getHighlightColor

      public org.bukkit.Color getHighlightColor()
      Gets the configured highlight color, and returns the default if there is no found color
      Returns:
      Color
    • highlightVillagerWorkstation

      public void highlightVillagerWorkstation()
      Checks villager PDC switch, checks if workstation exists, summonds block display, sets villager switch on, adds villager and display to map
    • summonBlockDisplayEntity

      public void summonBlockDisplayEntity()
      Summons the block display Uses getJobBlock(), xScaleOffset, yScaleOffset, zScaleOffset, blockLight, skyLight
    • addVillagerAndBlockDisplayToMap

      public void addVillagerAndBlockDisplayToMap()
      Adds the villager and block display to the map of currently highlighted workstations
    • setVillagerPDCSwitchOn

      public void setVillagerPDCSwitchOn()
      Sets the villager PDC switch on (1b) signifying that this villager's workstation is currently highlighted
    • getBlockDisplayEntity

      public org.bukkit.entity.BlockDisplay getBlockDisplayEntity()
      Gets the block display entity that was spawned
      Returns:
      BlockDisplay
    • getCurrentSwitchState

      public byte getCurrentSwitchState()
      Gets the villager's current switch state 0b for no current workstations highlighted 1b for currently highlighted workstations
      Returns:
      byte
    • checkPlayerPDC

      public void checkPlayerPDC()
      Checks player's output toggle state and sets playerHighlightToggleEnabled
    • setBlockLight

      public void setBlockLight(int blockLight)
      Sets the blocklight for the block display entity 15 by default
      Parameters:
      blockLight - int
    • setSkyLight

      public void setSkyLight(int skyLight)
      Sets the skylight for the block display entity 15 by default
      Parameters:
      skyLight - int
    • setXScaleOffset

      public void setXScaleOffset(float xScaleOffset)
      Sets the x scale offset for the block display entity -0.03f by default
      Parameters:
      xScaleOffset - float
    • setYScaleOffset

      public void setYScaleOffset(float yScaleOffset)
      Sets the y scale offset for the block display entity -0.03f by default
      Parameters:
      yScaleOffset - float
    • setZScaleOffset

      public void setZScaleOffset(float zScaleOffset)
      Sets the z scale offset for the block display entity -0.03f by default
      Parameters:
      zScaleOffset - float
    • setDefaultColor

      public void setDefaultColor(org.bukkit.Color defaultColor)
      Sets default color to be used if no colors load from the main config Color.fromRGB(255,255,255) by default
      Parameters:
      defaultColor - Color
    • getPlayerHighlightToggleEnabled

      public boolean getPlayerHighlightToggleEnabled()
      Checks if player's highlight toggle is shown as enabled
      Returns:
      boolean
    • overridePlayerHighlightToggleEnabled

      public void overridePlayerHighlightToggleEnabled(boolean playerHighlightToggleEnabled)
      Overrides the playerHighlightToggleEnabled value, sets it to a new value regardless of the player's settings
      Parameters:
      playerHighlightToggleEnabled - boolean