summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/event/block/BlockRightClickedEvent.java
blob: 6a11acaccf8d810efb88ed771051287dd0cc651c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package org.bukkit.event.block;

import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.ItemStack;
import org.bukkit.Player;

/**
 * Not implemented yet
 */
public class BlockRightClickedEvent extends BlockEvent  {
    protected Block clickedBlock;
    protected BlockFace direction;
    protected ItemStack itemInHand;
    protected Player player;

    public BlockRightClickedEvent(Type type, Block placedAgainst, BlockFace direction, ItemStack itemInHand, Player thePlayer) {
        super(type, placedAgainst);
        this.clickedBlock = placedAgainst;
        this.direction = direction;
        this.itemInHand = itemInHand;
        this.player = thePlayer;
    }

    /**
     * Gets the player who placed this block
     *
     * @return Player who placed the block
     */
    public Player getPlayer() {
        return player;
    }
    

    /**
     * Get the block that this block was placed against
     * 
     * @return Block the block that the new block was placed against
     */
    public Block getBlockAgainst() {
        return clickedBlock;
    }
    
    /**
     * @return BlockFace the direction this block was clicked
     */
    public BlockFace getDirection() {
        return direction;
    }

    /**
     * Returns the item in your hand when you placed the block
     * 
     * @return ItemStack the item in your hand when placing the block
     */
    public ItemStack getItemInHand() {
        return itemInHand;
    }
}