shard lose event

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


Package

bg.pikz.shards.api.events.ShardLoseEvent

Event Information

Property
Value

Cancellable

Yes

Async

No


Methods

getPlayer()

Gets the player losing shards.

Player getPlayer()

Returns: The player


getAmount()

Gets the amount of shards being lost.

Returns: The shard amount


setAmount(long amount)

Sets a new amount of shards to be lost.

Parameters:

  • amount - The new amount


getReason()

Gets the reason for losing shards.

Returns: The LoseReason 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


LoseReason Enum

Value
Description

SHOP_PURCHASE

Shards spent on a shop purchase

PAYMENT_SENT

Shards sent to another player via /shard pay

ADMIN_TAKE

Shards taken by an admin command

OTHER

Any other source


Basic Listener Example


Apply Discount Example


Cancel Event Example


Transaction Logging Example


Complete Integration Example