summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/event/player/PlayerItemHeldEvent.java
blob: dcda3f7fa077b7e5a3940bec4c0212a9dd399fd4 (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

package org.bukkit.event.player;

import org.bukkit.entity.Player;

/**
 * Fired when a player changes their currently held item
 */
public class PlayerItemHeldEvent extends PlayerEvent {
    private int previous;
    private int current;

    public PlayerItemHeldEvent(final Player player, final int previous, final int current) {
        super(Type.PLAYER_ITEM_HELD, player);
        this.previous = previous;
        this.current = current;
    }

    /**
     * Gets the previous held slot index
     *
     * @return Previous slot index
     */
    public int getPreviousSlot() {
        return previous;
    }

    /**
     * Gets the new held slot index
     *
     * @return New slot index
     */
    public int getNewSlot() {
        return current;
    }
}