|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPluginListener
public class PluginListener extends java.lang.Object
PluginListener.java - Extend this and register it to listen to specific hooks.
Modifier and Type | Class and Description |
---|---|
static class |
PluginListener.Priority
Priority - Used for priority for plugin listeners |
Constructor and Description |
---|
PluginListener()
|
Modifier and Type | Method and Description |
---|---|
void |
onArmSwing(Player player)
Called when a player swings their arm, aka left clicks (even if no block is in front of them) |
boolean |
onAttack(LivingEntity attacker,
LivingEntity defender,
java.lang.Integer amount)
Called when an entity (attacker) tries to hurt a player (defender). |
void |
onBan(Player mod,
Player player,
java.lang.String reason)
Called when a player is banned |
boolean |
onBlockBreak(Player player,
Block block)
Called when a person actually breaks the block. |
boolean |
onBlockCreate(Player player,
Block blockPlaced,
Block blockClicked,
int itemInHand)
Deprecated. use onBlockRightClick to get the information |
boolean |
onBlockDestroy(Player player,
Block block)
Called when a person left clicks a block. |
boolean |
onBlockPhysics(Block block,
boolean placed)
Called when the game is checking the physics for a certain block. |
boolean |
onBlockPlace(Player player,
Block blockPlaced,
Block blockClicked,
Item itemInHand)
Called when someone places a block. |
void |
onBlockRightClicked(Player player,
Block blockClicked,
Item item)
Called when someone presses right click aimed at a block. |
boolean |
onChat(Player player,
java.lang.String message)
Called when a player talks. |
boolean |
onCommand(Player player,
java.lang.String[] split)
Called before the command is parsed. |
boolean |
onConsoleCommand(java.lang.String[] split)
Called before the console command is parsed. |
boolean |
onDamage(PluginLoader.DamageType type,
BaseEntity attacker,
BaseEntity defender,
int amount)
Called when a living object is attacked. |
void |
onDisconnect(Player player)
Called on player disconnect |
boolean |
onExplode(Block block)
Called when a dynamite block or a creeper is triggerd. |
boolean |
onFlow(Block blockFrom,
Block blockTo)
Called when fluid wants to flow to a certain block. |
boolean |
onHealthChange(Player player,
int oldValue,
int newValue)
Called when a players health changes. |
boolean |
onIgnite(Block block,
Player player)
Called when either a lava block or a lighter tryes to light something on fire. |
boolean |
onInventoryCursorSwap(Player player,
Inventory inventory,
java.lang.Integer slot,
Item oldItemInSlot,
Item newItemInSlot)
Called when a slot's contents are swapped with the contents of the cursor. |
boolean |
onInventoryPlaceItem(Player player,
Inventory inventory,
Item placedItem,
java.lang.Integer slot)
Called when the player places an inventory item, or adds amount to an existing inventory slot. |
boolean |
onInventoryTakeItem(Player player,
Inventory inventory,
Item takenItem,
java.lang.Integer slot)
Called when the player takes an inventory item, whether they selected half or the whole slot. |
void |
onIpBan(Player mod,
Player player,
java.lang.String reason)
Called when a player is IP banned |
boolean |
onItemDrop(Player player,
Item item)
Called when a player drops an item. |
boolean |
onItemPickUp(Player player,
Item item)
Called when a player picks up an item. |
boolean |
onItemUse(Player player,
Block blockPlaced,
Block blockClicked,
Item item)
Called when a player uses an item (rightclick with item in hand) |
void |
onKick(Player mod,
Player player,
java.lang.String reason)
Called when a player is kicked |
boolean |
onLeafDecay(Block block)
Called when a leaf block is about to decay. |
PluginLoader.HookResult |
onLiquidDestroy(PluginLoader.HookResult currentState,
int liquidBlockId,
Block targetBlock)
Called when water or lava tries to populate a block, you can prevent crushing of torches, railways, flowers etc. |
void |
onLogin(Player player)
Called during the later login process |
java.lang.String |
onLoginChecks(java.lang.String user)
Called during the early login process to check whether or not to kick the player |
boolean |
onMobSpawn(Mob mob)
|
boolean |
onOpenInventory(Player player,
Inventory inventory)
Called when a player attempts to open an inventory; whether it's a workbench, a chest or their own player inventory |
void |
onPlayerMove(Player player,
Location from,
Location to)
Called when a player moves from one block to another |
int |
onRedstoneChange(Block block,
int oldLevel,
int newLevel)
Called whenever a redstone source (wire, switch, torch) changes its current. |
boolean |
onSignChange(Player player,
Sign sign)
Called when a sign is changed by a player (Usually, when they first place it) |
void |
onSignShow(Player player,
Sign sign)
Called when a sign is shown to a player, most often when they come into range of a sign. |
boolean |
onTeleport(Player player,
Location from,
Location to)
Called when a player teleports from one location to another |
java.lang.Boolean |
onVehicleCollision(BaseVehicle vehicle,
BaseEntity collisioner)
Called when a collision occurs with a vehicle and an entity. |
void |
onVehicleCreate(BaseVehicle vehicle)
Called when you place a vehicle. |
boolean |
onVehicleDamage(BaseVehicle vehicle,
BaseEntity attacker,
int damage)
Called when vehicle receives damage |
void |
onVehicleDestroyed(BaseVehicle vehicle)
Called when a vehicle is destroyed |
void |
onVehicleEnter(BaseVehicle vehicle,
HumanEntity player)
Called when a player enter or leaves a vehicle |
void |
onVehiclePositionChange(BaseVehicle vehicle,
int x,
int y,
int z)
Called when a vehicle changes block |
void |
onVehicleUpdate(BaseVehicle vehicle)
Called when a vehicle changes speed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PluginListener()
Method Detail |
---|
public void onPlayerMove(Player player, Location from, Location to)
player
- player movingfrom
- previous block locationto
- current block locationpublic boolean onTeleport(Player player, Location from, Location to)
player
- player movingfrom
- previous block locationto
- current block locationpublic java.lang.String onLoginChecks(java.lang.String user)
user
- public void onLogin(Player player)
player
- public void onDisconnect(Player player)
player
- public boolean onChat(Player player, java.lang.String message)
player
- message
- public boolean onCommand(Player player, java.lang.String[] split)
player
- split
- public boolean onConsoleCommand(java.lang.String[] split)
split
- public void onBan(Player mod, Player player, java.lang.String reason)
mod
- moderator that's banningplayer
- player being bannedreason
- reason for banpublic void onIpBan(Player mod, Player player, java.lang.String reason)
mod
- moderator that's banningplayer
- player being banningreason
- for IP banpublic void onKick(Player mod, Player player, java.lang.String reason)
mod
- moderator that's kickingplayer
- player being kickedreason
- reason for kick@Deprecated public boolean onBlockCreate(Player player, Block blockPlaced, Block blockClicked, int itemInHand)
player
- blockPlaced
- blockClicked
- itemInHand
- onBlockRightClicked(Player, Block, Item)
,
onBlockPlace(Player, Block, Block, Item)
,
onItemUse(Player, Block, Block, Item)
public boolean onBlockDestroy(Player player, Block block)
player
- block
- public boolean onBlockBreak(Player player, Block block)
player
- block
- public void onArmSwing(Player player)
player
- player swingingpublic boolean onItemDrop(Player player, Item item)
player
- player who dropped the itemitem
- item that was droppedpublic boolean onItemPickUp(Player player, Item item)
player
- player who picked up the itemitem
- item that was picked uppublic boolean onIgnite(Block block, Player player)
block
- block that the fire wants to spawn in.player
- playerpublic boolean onExplode(Block block)
block
- dynamite block/creeper location block.public boolean onFlow(Block blockFrom, Block blockTo)
blockFrom
- the block where the fluid came from.
(blocktype = fluid type)blockTo
- the block where fluid wants to flow to.public boolean onMobSpawn(Mob mob)
mob
- Mob attempting to spawn.public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount)
type
- type of damage dealt.attacker
- object that is attacking.defender
- object that is defending.amount
- amount of damage dealt.public boolean onHealthChange(Player player, int oldValue, int newValue)
player
- the player which health is changed.oldValue
- old lives valuenewValue
- new lives valuepublic int onRedstoneChange(Block block, int oldLevel, int newLevel)
block
- oldLevel
- the old currentnewLevel
- the new currentpublic boolean onBlockPhysics(Block block, boolean placed)
block
- Block which requires special physicsplaced
- True if block was just placedpublic void onVehicleCreate(BaseVehicle vehicle)
vehicle
- the vehicle placedpublic boolean onVehicleDamage(BaseVehicle vehicle, BaseEntity attacker, int damage)
vehicle
- attacker
- entity that dealt the damagedamage
- public void onVehicleUpdate(BaseVehicle vehicle)
vehicle
- the vehiclepublic java.lang.Boolean onVehicleCollision(BaseVehicle vehicle, BaseEntity collisioner)
vehicle
- the vehiclecollisioner
- public void onVehicleDestroyed(BaseVehicle vehicle)
vehicle
- the vehiclepublic void onVehicleEnter(BaseVehicle vehicle, HumanEntity player)
vehicle
- the vehicleplayer
- the playerpublic void onVehiclePositionChange(BaseVehicle vehicle, int x, int y, int z)
vehicle
- the vehiclex
- coordinate xy
- coordinate yz
- coordinate zpublic boolean onItemUse(Player player, Block blockPlaced, Block blockClicked, Item item)
player
- the playerblockPlaced
- where a block would end up when the item was a bucketblockClicked
- item
- the item being used (in hand)public boolean onBlockPlace(Player player, Block blockPlaced, Block blockClicked, Item itemInHand)
player
- blockPlaced
- blockClicked
- itemInHand
- public void onBlockRightClicked(Player player, Block blockClicked, Item item)
player
- blockClicked
- itemInHand
- public PluginLoader.HookResult onLiquidDestroy(PluginLoader.HookResult currentState, int liquidBlockId, Block targetBlock)
currentState
- the current tristate, once it's set to a non DEFAULT_ACTION it is final.liquidBlock
- the type of the attacking blocktargetBlock
- the block to be destroyedpublic boolean onAttack(LivingEntity attacker, LivingEntity defender, java.lang.Integer amount)
LivingEntity.getLastDamage()
the defender has.
attacker
- the giverdefender
- the takeramount
- of damage the entity tries to dopublic boolean onOpenInventory(Player player, Inventory inventory)
player
- user who attempted to open the inventoryinventory
- the inventory that they are attempting to openpublic void onSignShow(Player player, Sign sign)
player
- Player who this sign is being shown tosign
- Sign which is being shown to the playerpublic boolean onSignChange(Player player, Sign sign)
player
- Player who changed the signsign
- Sign which had changedpublic boolean onLeafDecay(Block block)
block
- The leaf block about to decaypublic boolean onInventoryPlaceItem(Player player, Inventory inventory, Item placedItem, java.lang.Integer slot)
player
- Player who placed their inventory iteminventory
- The inventory that had an item placedplacedItem
- The item (and amount) that was placed.oldSlot
- The slot that the item was placed in.public boolean onInventoryTakeItem(Player player, Inventory inventory, Item takenItem, java.lang.Integer slot)
player
- Player who took their inventory iteminventory
- The inventory that had an item takentakenItem
- The item (and amount) that was takenoldSlot
- The slot that the item was taken from.public boolean onInventoryCursorSwap(Player player, Inventory inventory, java.lang.Integer slot, Item oldItemInSlot, Item newItemInSlot)
player
- Player who swapped their inventory iteminventory
- The inventory that had an item swappedslot
- The slot that had items swappedoldItemInSlot
- The old item in the slot, which is now on the cursornewItemInSlot
- The new item in the slot, which was on the cursor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |