File tree 9 files changed +121
-17
lines changed
src/main/java/com/github/teraprath/tinylib
9 files changed +121
-17
lines changed Original file line number Diff line number Diff line change 4
4
5
5
<groupId >com.github.teraprath.tinylib</groupId >
6
6
<artifactId >TinyLib</artifactId >
7
- <version >2.2.1 </version >
7
+ <version >2.2.2 </version >
8
8
9
9
<name >TinyLib</name >
10
10
Original file line number Diff line number Diff line change
1
+ package com .github .teraprath .tinylib .game .api .event ;
2
+
3
+ import com .github .teraprath .tinylib .game .api .GameAPI ;
4
+ import com .github .teraprath .tinylib .game .api .timer .WaitingTimer ;
5
+ import org .bukkit .event .Event ;
6
+ import org .bukkit .event .HandlerList ;
7
+ import org .jetbrains .annotations .NotNull ;
8
+
9
+ public class RunningCompleteEvent extends Event {
10
+
11
+ private static final HandlerList HANDLER_LIST = new HandlerList ();
12
+ private final GameAPI api ;
13
+
14
+ public RunningCompleteEvent (final GameAPI api ) {
15
+ this .api = api ;
16
+ }
17
+
18
+ @ Override
19
+ public @ NotNull HandlerList getHandlers () {
20
+ return HANDLER_LIST ;
21
+ }
22
+
23
+ public static HandlerList getHandlerList () { return HANDLER_LIST ; }
24
+
25
+ public WaitingTimer getTimer () { return this .api .getWaitingTimer (); }
26
+
27
+ public GameAPI getGame () { return this .api ; }
28
+
29
+ }
Original file line number Diff line number Diff line change
1
+ package com .github .teraprath .tinylib .game .api .event ;
2
+
3
+ import com .github .teraprath .tinylib .game .api .GameAPI ;
4
+ import com .github .teraprath .tinylib .game .api .timer .WaitingTimer ;
5
+ import org .bukkit .event .Event ;
6
+ import org .bukkit .event .HandlerList ;
7
+ import org .jetbrains .annotations .NotNull ;
8
+
9
+ public class ShutdownCompleteEvent extends Event {
10
+
11
+ private static final HandlerList HANDLER_LIST = new HandlerList ();
12
+ private final GameAPI api ;
13
+
14
+ public ShutdownCompleteEvent (final GameAPI api ) {
15
+ this .api = api ;
16
+ }
17
+
18
+ @ Override
19
+ public @ NotNull HandlerList getHandlers () {
20
+ return HANDLER_LIST ;
21
+ }
22
+
23
+ public static HandlerList getHandlerList () { return HANDLER_LIST ; }
24
+
25
+ public WaitingTimer getTimer () { return this .api .getWaitingTimer (); }
26
+
27
+ public GameAPI getGame () { return this .api ; }
28
+
29
+ }
Original file line number Diff line number Diff line change
1
+ package com .github .teraprath .tinylib .game .api .event ;
2
+
3
+ import com .github .teraprath .tinylib .game .api .GameAPI ;
4
+ import com .github .teraprath .tinylib .game .api .timer .WaitingTimer ;
5
+ import org .bukkit .event .Event ;
6
+ import org .bukkit .event .HandlerList ;
7
+ import org .jetbrains .annotations .NotNull ;
8
+
9
+ public class WaitingCompleteEvent extends Event {
10
+
11
+ private static final HandlerList HANDLER_LIST = new HandlerList ();
12
+ private final GameAPI api ;
13
+
14
+ public WaitingCompleteEvent (final GameAPI api ) {
15
+ this .api = api ;
16
+ }
17
+
18
+ @ Override
19
+ public @ NotNull HandlerList getHandlers () {
20
+ return HANDLER_LIST ;
21
+ }
22
+
23
+ public static HandlerList getHandlerList () { return HANDLER_LIST ; }
24
+
25
+ public WaitingTimer getTimer () { return this .api .getWaitingTimer (); }
26
+
27
+ public GameAPI getGame () { return this .api ; }
28
+
29
+ }
Original file line number Diff line number Diff line change 1
1
package com .github .teraprath .tinylib .game .api .timer ;
2
2
3
3
import com .github .teraprath .tinylib .game .api .GameAPI ;
4
+ import com .github .teraprath .tinylib .game .api .event .RunningCompleteEvent ;
4
5
import com .github .teraprath .tinylib .game .api .event .RunningTickEvent ;
5
6
import com .github .teraprath .tinylib .game .state .GameState ;
6
7
import com .github .teraprath .tinylib .game .timer .GameTimer ;
7
8
8
9
public class RunningTimer extends GameTimer {
9
10
10
11
private final GameAPI api ;
11
- private final RunningTickEvent event ;
12
+ private final RunningTickEvent tickEvent ;
13
+ private final RunningCompleteEvent completeEvent ;
12
14
13
15
public RunningTimer (GameAPI api ) {
14
16
super (api .getPlugin (), api .getSettings ().getRunningDuration ());
15
17
this .api = api ;
16
- this .event = new RunningTickEvent (api );
18
+ this .tickEvent = new RunningTickEvent (api );
19
+ this .completeEvent = new RunningCompleteEvent (api );
17
20
}
18
21
19
22
@ Override
20
23
protected void onTick () {
21
- api .getPlugin ().getServer ().getPluginManager ().callEvent (event );
24
+ api .getPlugin ().getServer ().getPluginManager ().callEvent (tickEvent );
22
25
}
23
26
24
27
@ Override
25
28
protected void onComplete () {
29
+ api .getPlugin ().getServer ().getPluginManager ().callEvent (completeEvent );
26
30
api .setGameState (GameState .SHUTDOWN );
27
31
api .getShutdownTimer ().start ();
28
32
}
Original file line number Diff line number Diff line change 2
2
3
3
import com .github .teraprath .tinylib .game .api .GameAPI ;
4
4
import com .github .teraprath .tinylib .game .api .event .GameShutdownEvent ;
5
+ import com .github .teraprath .tinylib .game .api .event .ShutdownCompleteEvent ;
5
6
import com .github .teraprath .tinylib .game .api .event .ShutdownTickEvent ;
6
7
import com .github .teraprath .tinylib .game .timer .GameTimer ;
7
8
8
9
public class ShutdownTimer extends GameTimer {
9
10
10
11
private final GameAPI api ;
11
- private final ShutdownTickEvent event ;
12
+ private final ShutdownTickEvent tickEvent ;
13
+ private final ShutdownCompleteEvent completeEvent ;
12
14
13
15
public ShutdownTimer (GameAPI api ) {
14
16
super (api .getPlugin (), api .getSettings ().getShutdownDuration ());
15
17
this .api = api ;
16
- this .event = new ShutdownTickEvent (api );
18
+ this .tickEvent = new ShutdownTickEvent (api );
19
+ this .completeEvent = new ShutdownCompleteEvent (api );
17
20
}
18
21
19
22
@ Override
20
23
protected void onTick () {
21
- api .getPlugin ().getServer ().getPluginManager ().callEvent (event );
24
+ api .getPlugin ().getServer ().getPluginManager ().callEvent (tickEvent );
22
25
}
23
26
24
27
@ Override
25
28
protected void onComplete () {
29
+ api .getPlugin ().getServer ().getPluginManager ().callEvent (completeEvent );
26
30
api .getPlugin ().getServer ().getPluginManager ().callEvent (new GameShutdownEvent (this .api ));
27
31
api .getPlugin ().getServer ().shutdown ();
28
32
}
Original file line number Diff line number Diff line change 1
1
package com .github .teraprath .tinylib .game .api .timer ;
2
2
3
3
import com .github .teraprath .tinylib .game .api .GameAPI ;
4
+ import com .github .teraprath .tinylib .game .api .event .WaitingCompleteEvent ;
4
5
import com .github .teraprath .tinylib .game .api .event .WaitingTickEvent ;
5
6
import com .github .teraprath .tinylib .game .state .GameState ;
6
7
import com .github .teraprath .tinylib .game .timer .GameTimer ;
7
8
8
9
public class WaitingTimer extends GameTimer {
9
10
10
11
private final GameAPI api ;
11
- private final WaitingTickEvent event ;
12
+ private final WaitingTickEvent tickEvent ;
13
+ private final WaitingCompleteEvent completeEvent ;
12
14
13
15
public WaitingTimer (GameAPI api ) {
14
16
super (api .getPlugin (), api .getSettings ().getWaitingDuration ());
15
17
this .api = api ;
16
- this .event = new WaitingTickEvent (api );
18
+ this .tickEvent = new WaitingTickEvent (api );
19
+ this .completeEvent = new WaitingCompleteEvent (api );
17
20
}
18
21
19
22
@ Override
20
23
protected void onTick () {
21
- api .getPlugin ().getServer ().getPluginManager ().callEvent (event );
24
+ api .getPlugin ().getServer ().getPluginManager ().callEvent (tickEvent );
22
25
}
23
26
24
27
@ Override
25
28
protected void onComplete () {
29
+ api .getPlugin ().getServer ().getPluginManager ().callEvent (completeEvent );
26
30
api .setGameState (GameState .RUNNING );
27
31
api .getRunningTimer ().start ();
28
32
}
Original file line number Diff line number Diff line change @@ -93,6 +93,11 @@ public ItemBuilder setLore(@Nonnull Component... components) {
93
93
return this ;
94
94
}
95
95
96
+ public ItemBuilder setLore (@ Nonnull List <Component > lore ) {
97
+ this .meta .lore (lore );
98
+ return this ;
99
+ }
100
+
96
101
/**
97
102
* Sets whether the item is unbreakable.
98
103
*
You can’t perform that action at this time.
0 commit comments