-
Notifications
You must be signed in to change notification settings - Fork 658
Expand file tree
/
Copy pathAsyncAutoEnchanterProcessEvent.java
More file actions
93 lines (75 loc) · 2.47 KB
/
Copy pathAsyncAutoEnchanterProcessEvent.java
File metadata and controls
93 lines (75 loc) · 2.47 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package io.github.thebusybiscuit.slimefun4.api.events;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.enchanting.AutoEnchanter;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
/**
* An {@link Event} that is called whenever an {@link AutoEnchanter} is
* enchanting an {@link ItemStack}.
*
* @author StarWishsama
*/
public class AsyncAutoEnchanterProcessEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final ItemStack item;
private final ItemStack enchantedBook;
private final BlockMenu menu;
private boolean cancelled;
public AsyncAutoEnchanterProcessEvent(@Nonnull ItemStack item, @Nonnull ItemStack enchantedBook, @Nonnull BlockMenu menu) {
super(true);
Preconditions.checkNotNull(item, "The item to enchant cannot be null!");
Preconditions.checkNotNull(enchantedBook, "The enchanted book to enchant cannot be null!");
Preconditions.checkNotNull(menu, "The menu of auto-enchanter cannot be null!");
this.item = item;
this.enchantedBook = enchantedBook;
this.menu = menu;
}
/**
* This returns the {@link ItemStack} that is being enchanted.
*
* @return The {@link ItemStack} that is being enchanted
*/
@Nonnull
public ItemStack getItem() {
return item;
}
/**
* This returns the {@link ItemStack} that is being used enchanted book
*
* @return The {@link ItemStack} that is being used enchanted book
*/
@Nonnull
public ItemStack getEnchantedBook() {
return enchantedBook;
}
/**
* This returns the {@link AutoEnchanter}'s {@link BlockMenu}
*
* @return The {@link BlockMenu} of {@link AutoEnchanter} that is enchanting item
*/
@Nonnull
public BlockMenu getMenu() {
return menu;
}
@Nonnull
public static HandlerList getHandlerList() {
return handlers;
}
@Nonnull
@Override
public HandlerList getHandlers() {
return getHandlerList();
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
}