forked from Slimefun/Slimefun4
-
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathAsyncMachineOperationStartEvent.java
More file actions
78 lines (66 loc) · 2.15 KB
/
Copy pathAsyncMachineOperationStartEvent.java
File metadata and controls
78 lines (66 loc) · 2.15 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package io.github.thebusybiscuit.slimefun4.api.events;
import io.github.bakedlibs.dough.blocks.BlockPosition;
import io.github.thebusybiscuit.slimefun4.core.machines.MachineOperation;
import io.github.thebusybiscuit.slimefun4.core.machines.MachineProcessor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.bukkit.Bukkit;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class AsyncMachineOperationStartEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final BlockPosition position;
private final MachineProcessor<?> machineProcessor;
private final MachineOperation machineOperation;
private boolean cancel;
public <T extends MachineOperation> AsyncMachineOperationStartEvent(
BlockPosition pos, MachineProcessor<T> processor, T operation) {
super(!Bukkit.isPrimaryThread());
this.position = pos;
this.machineProcessor = processor;
this.machineOperation = operation;
}
/**
* This returns the {@link BlockPosition} of the machine.
*
* @return The {@link BlockPosition} of the machine
*/
@Nonnull
public BlockPosition getPosition() {
return position;
}
/**
* The {@link MachineProcessor} instance of the machine.
*
* @return The {@link MachineProcessor} instance of the machine
*/
@Nullable public MachineProcessor<?> getProcessor() {
return machineProcessor;
}
/**
* This returns the used {@link MachineOperation} in the process.
*
* @return The {@link MachineOperation} of the process
*/
@Nullable public MachineOperation getOperation() {
return machineOperation;
}
@Nonnull
public static HandlerList getHandlerList() {
return handlers;
}
@Nonnull
@Override
public HandlerList getHandlers() {
return getHandlerList();
}
@Override
public boolean isCancelled() {
return this.cancel;
}
@Override
public void setCancelled(boolean b) {
this.cancel = b;
}
}