Package simplexity.villagerinfo.events
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
ConstructorDescriptionWorkstationHighlightEvent
(org.bukkit.entity.Player player, org.bukkit.entity.Villager villager, org.bukkit.NamespacedKey namespacedKey) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the villager and block display to the map of currently highlighted workstationsvoid
Checks player's output toggle state and sets playerHighlightToggleEnabledorg.bukkit.entity.BlockDisplay
Gets the block display entity that was spawnedbyte
Gets the villager's current switch state 0b for no current workstations highlighted 1b for currently highlighted workstationsstatic org.bukkit.event.HandlerList
Gets the handler list for this evene@NotNull org.bukkit.event.HandlerList
Gets the handler list for this eveneorg.bukkit.Color
Gets the configured highlight color, and returns the default if there is no found colororg.bukkit.block.Block
Gets the villager's workstation block, returns null if there is none foundboolean
Checks if player's highlight toggle is shown as enabledorg.bukkit.entity.Villager
Gets the villager from this eventvoid
Checks villager PDC switch, checks if workstation exists, summonds block display, sets villager switch on, adds villager and display to mapboolean
Gets whether this event has been cancelledvoid
overridePlayerHighlightToggleEnabled
(boolean playerHighlightToggleEnabled) Overrides the playerHighlightToggleEnabled value, sets it to a new value regardless of the player's settingsvoid
setBlockLight
(int blockLight) Sets the blocklight for the block display entity 15 by defaultvoid
setCancelled
(boolean cancel) Sets whether this event should be cancelledvoid
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 defaultvoid
setSkyLight
(int skyLight) Sets the skylight for the block display entity 15 by defaultvoid
Sets the villager PDC switch on (1b) signifying that this villager's workstation is currently highlightedvoid
setXScaleOffset
(float xScaleOffset) Sets the x scale offset for the block display entity -0.03f by defaultvoid
setYScaleOffset
(float yScaleOffset) Sets the y scale offset for the block display entity -0.03f by defaultvoid
setZScaleOffset
(float zScaleOffset) Sets the z scale offset for the block display entity -0.03f by defaultvoid
Summons the block display Uses getJobBlock(), xScaleOffset, yScaleOffset, zScaleOffset, blockLight, skyLightMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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 interfaceorg.bukkit.event.Cancellable
- Returns:
- boolean
-
setCancelled
public void setCancelled(boolean cancel) Sets whether this event should be cancelled- Specified by:
setCancelled
in interfaceorg.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 classorg.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
-