summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/event/painting/PaintingBreakEvent.java
blob: 8268b00d447ca528ac859e61eb96de3ad5970e49 (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
60
61
62
package org.bukkit.event.painting;

import org.bukkit.entity.Painting;
import org.bukkit.event.Cancellable;

/**
 * Triggered when a painting is removed
 */
@SuppressWarnings("serial")
public class PaintingBreakEvent extends PaintingEvent implements Cancellable {

    private boolean cancelled;
    private RemoveCause cause;

    public PaintingBreakEvent(final Painting painting, RemoveCause cause) {
        super(Type.PAINTING_BREAK, painting);
        this.cause = cause;
    }

    /**
     * Gets the cause for the painting's removal
     *
     * @return the RemoveCause for the painting's removal
     */
    public RemoveCause getCause() {
        return cause;
    }

    public boolean isCancelled() {
        return cancelled;
    }

    public void setCancelled(boolean cancel) {
        this.cancelled = cancel;
    }

    /**
     * An enum to specify the cause of the removal
     */
    public enum RemoveCause {
        /**
         * Removed by an entity
         */
        ENTITY,
        /**
         * Removed by fire
         */
        FIRE,
        /**
         * Removed by placing a block on it
         */
        OBSTRUCTION,
        /**
         * Removed by water flowing over it
         */
        WATER,
        /**
         * Removed by destroying the block behind it, etc
         */
        PHYSICS,
    }
}