forked from ChestShop-authors/ChestShop-3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
PreShopCreationItemDisplayNameEvent.java
46 lines (35 loc) · 1.26 KB
/
PreShopCreationItemDisplayNameEvent.java
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
package com.Acrobot.ChestShop.Events;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
/**
* Represents an event that is fired before the display name of an item in a shop is created.
* The final value of displayName will be displayed on the sign of the newly created shop.
*/
public class PreShopCreationItemDisplayNameEvent extends Event {
private final ItemStack itemStack;
private String displayName;
public PreShopCreationItemDisplayNameEvent(ItemStack itemStack, String displayName) {
this.itemStack = itemStack;
this.displayName = displayName;
}
public ItemStack getItemStack() {
return itemStack.clone();
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
if (displayName == null || displayName.isBlank())
throw new IllegalArgumentException("The display name can't be blank or null.");
this.displayName = displayName;
}
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}