Package io.papermc.paper.event.player

# Class PlayerChangeBeaconEffectEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent

All Implemented Interfaces:
  `Cancellable`

public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable
Called when a player sets the effect for a beacon

## Nested Class Summary

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

`Event.Result`

## Field Summary

### Fields inherited from class org.bukkit.event.player.PlayerEvent

`player`

## Constructor Summary

Constructors
Constructor
Description
`PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @Nullable Block beacon)`

## Method Summary

Modifier and Type
Method
Description
`@Nullable Block`
`getBeacon()`
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@Nullable PotionEffectType`
`getPrimary()`
`@Nullable PotionEffectType`
`getSecondary()`
`boolean`
`isCancelled()`
Gets the cancellation state of this event.
`void`
`setCancelled(boolean cancel)`
Sets the cancellation state of this event.
`void`
`setConsumeItem(boolean consumeItem)`
Sets if the item used to change the beacon should be consumed.
`void`
`setPrimary(@Nullable PotionEffectType primary)`
Sets the primary effect
`void`
`setSecondary(@Nullable PotionEffectType secondary)`
Sets the secondary effect
`boolean`
`willConsumeItem()`
Gets if the item used to change the beacon will be consume.

### Methods inherited from class org.bukkit.event.player.PlayerEvent

`getPlayer`

### 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

### PlayerChangeBeaconEffectEvent

public PlayerChangeBeaconEffectEvent(@NotNull @NotNull Player player, @Nullable @Nullable PotionEffectType primary, @Nullable @Nullable PotionEffectType secondary, @Nullable @Nullable Block beacon)

## Method Details

### getPrimary

@Nullable public @Nullable PotionEffectType getPrimary()

Returns:
  the primary effect

### setPrimary

public void setPrimary(@Nullable @Nullable PotionEffectType primary)
Sets the primary effect

NOTE: The primary effect still has to be one of the valid effects for a beacon.

Parameters:
  `primary` - the primary effect

### getSecondary

@Nullable public @Nullable PotionEffectType getSecondary()

Returns:
  the secondary effect

### setSecondary

public void setSecondary(@Nullable @Nullable PotionEffectType secondary)
Sets the secondary effect

This only has an effect when the beacon is able to accept a secondary effect. NOTE: The secondary effect still has to be a valid effect for a beacon.

Parameters:
  `secondary` - the secondary effect

### getBeacon

@Nullable public @Nullable Block getBeacon()

Returns:
  the beacon block associated with this event, or null if not found

### willConsumeItem

public boolean willConsumeItem()
Gets if the item used to change the beacon will be consume.

Independant of `isCancelled()`. If the event is cancelled the item will NOT be consumed.

Returns:
  true if item will be consumed

### setConsumeItem

public void setConsumeItem(boolean consumeItem)
Sets if the item used to change the beacon should be consumed.

Independant of `isCancelled()`. If the event is cancelled the item will NOT be consumed.

Parameters:
  `consumeItem` - true if item should be consumed

### isCancelled

public boolean isCancelled()
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

If a `PlayerChangeBeaconEffectEvent` is cancelled, the changes will not take effect

Specified by:
  `isCancelled` in interface `Cancellable`
Returns:
  true if this event is cancelled

### setCancelled

public void setCancelled(boolean cancel)
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

If cancelled, the item will NOT be consumed regardless of what `willConsumeItem()` says

If a `PlayerChangeBeaconEffectEvent` is cancelled, the changes will not be applied or saved.

Specified by:
  `setCancelled` in interface `Cancellable`
Parameters:
  `cancel` - true if you wish to cancel this event

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()