Documentation/API

BagOpenEvent


extends BagEvent
implements Cancellable

Called whenever a bag is opened by a player, whether that is their own or another player's bag.

Methods

org.bukkit.entity.Player getPlayer()
Returns the Player that is opening a bag.

me.greenadine.playerbags.Bag getBag()
Returns the bag that is being opened.

boolean isOwner()
Returns 'true' if the bag is being opened is the player's own bag. Returns false if otherwise.

boolean hasPermission()
Returns 'true' if the player has permission to open this bag. Returns false if otherwise.

 

BagCloseEvent


extends BagEvent
implements Cancellable

Called whenever player closes a bag, whether that is their own or another player's bag.

Methods

org.bukkit.entity.Player getPlayer()
Returns the Player that is opening a bag.

me.greenadine.playerbags.Bag getBag()
Returns the bag that is being opened.

 

AsyncBagEditEvent


extends BagEvent
implements Cancellable

Called whenever the contents of a bag is being manipulated, the contents are being cleared, the size is being changed or when a new bag is created. Note that when a new bag is being created for a new player, this can not be prevented by cancelling the event. NOTE: This event is async.

Methods

org.bukkit.entity.Player getPlayer()
Returns the Player that is editing a bag.

me.greenadine.playerbags.Bag getBag()
Returns the bag that is being edited.

boolean isOwner()
Returns 'true' if the bag is being edited is the player's own bag. Returns false if otherwise.

boolean hasPermission()
Returns 'true' if the player has permission to edit this bag. Returns false if otherwise.

me.greenadine.playerbags.api.event.BagAction getAction()
Returns the BagAction. This represents the action that is being performed on the bag.

 

BagAction


CREATE

Represents whenever a bag is created. For example, when a new player joins, a BagEditEvent with this BagAction is called. NOTE: in the case of a new player joining and a bag is being created for them, the event can not be cancelled.

MOVE_ITEM

Represents when a single item is being moved in, within or out of a bag by regular mouse clicking.

SHIFT_MOVE_ITEM

Represents when a single item is being moved in or out a bag by shift-clicking.

DRAG_ITEMS

Represents when an item is being dragged over several bag slots.

CONVERT_SIZE

Represents when a bag's size is being converted to either a smaller or larger size.

CLEAR_CONTENTS

Represents when a bag's contents are being cleared.