shard gain event

Fired when a player gains shards. This event is cancellable.


Package

bg.pikz.shards.api.events.ShardGainEvent

Event Information

Property
Value

Cancellable

Yes

Async

No


Methods

getPlayer()

Gets the player gaining shards.

Player getPlayer()

Returns: The player


getAmount()

Gets the amount of shards being gained.

Returns: The shard amount


setAmount(long amount)

Sets a new amount of shards to be gained.

Parameters:

  • amount - The new amount


getReason()

Gets the reason for gaining shards.

Returns: The GainReason enum value


isCancelled()

Check if the event is cancelled.

Returns: true if cancelled


setCancelled(boolean cancelled)

Cancel or uncancel the event.

Parameters:

  • cancelled - Whether to cancel


GainReason Enum

Value
Description

REGION_GENERATION

Shards gained from being in an AFK region

KILL

Shards gained from killing another player

ADMIN_GIVE

Shards given by an admin command

PAYMENT_RECEIVED

Shards received from another player via /shard pay

SHOP_PURCHASE

Shards refunded from a shop purchase (rare)

OTHER

Any other source


Basic Listener Example


Modify Shard Amount Example


Cancel Event Example


Complete Integration Example