-
Notifications
You must be signed in to change notification settings - Fork 8
/
KelpSidebarUpdateEvent.java
58 lines (48 loc) · 1.46 KB
/
KelpSidebarUpdateEvent.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
47
48
49
50
51
52
53
54
55
56
57
58
package de.pxav.kelp.core.event.kelpevent.sidebar;
import de.pxav.kelp.core.event.kelpevent.KelpPlayerEvent;
import de.pxav.kelp.core.player.KelpPlayer;
import de.pxav.kelp.core.sidebar.type.KelpSidebar;
import org.bukkit.event.HandlerList;
/**
* This event is triggered when any {@link KelpSidebar<>} is updated no
* matter if it is a lazy or normal update. Title updates are not
* included.
*
* @author pxav
*/
public class KelpSidebarUpdateEvent extends KelpPlayerEvent {
private static final HandlerList handlers = new HandlerList();
private boolean lazyUpdate;
private KelpSidebar sidebar;
public KelpSidebarUpdateEvent(KelpPlayer who, KelpSidebar sidebar, boolean lazyUpdate) {
super(who);
this.sidebar = sidebar;
this.lazyUpdate = lazyUpdate;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Checks if the update was performed lazy, which means that
* no scores have been added/deleted from the board.
*
* @return {@code true} if the update was lazy.
*/
public boolean isLazyUpdate() {
return lazyUpdate;
}
/**
* Gets an instance of the scoreboard that has been updated.
* It can be casted to the specific type such as {@link de.pxav.kelp.core.sidebar.type.AnimatedSidebar}
* for example if needed.
*
* @return The current sidebar object.
*/
public KelpSidebar getSidebar() {
return sidebar;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
}