File tree Expand file tree Collapse file tree 5 files changed +46
-10
lines changed
java/com/github/sanctum/labyrinth/task Expand file tree Collapse file tree 5 files changed +46
-10
lines changed Original file line number Diff line number Diff line change 19
19
</content >
20
20
<orderEntry type =" inheritedJdk" />
21
21
<orderEntry type =" sourceFolder" forTests =" false" />
22
- <orderEntry type =" library" name =" Maven: com.github.ms5984.lib:menu-man:1.1.0" level =" project" />
23
22
<orderEntry type =" library" scope =" PROVIDED" name =" Maven: org.spigotmc:spigot-api:1.16.3-R0.1-SNAPSHOT" level =" project" />
24
23
<orderEntry type =" library" name =" Maven: commons-lang:commons-lang:2.6" level =" project" />
25
24
<orderEntry type =" library" name =" Maven: com.google.guava:guava:21.0" level =" project" />
33
32
<orderEntry type =" library" name =" Maven: junit:junit:4.10" level =" project" />
34
33
<orderEntry type =" library" name =" Maven: org.hamcrest:hamcrest-core:1.1" level =" project" />
35
34
<orderEntry type =" library" name =" Maven: com.github.ms5984.lib:menu-man:1.1.0" level =" project" />
36
- <orderEntry type =" library" name =" Maven: com.github.the-h-team:Enterprise:1.4 " level =" project" />
35
+ <orderEntry type =" library" name =" Maven: com.github.the-h-team:Enterprise:1.5 " level =" project" />
37
36
</component >
38
37
</module >
Original file line number Diff line number Diff line change 6
6
7
7
<groupId >com.github.sanctum.Labyrinth</groupId >
8
8
<artifactId >Labyrinth</artifactId >
9
- <version >1.2.9 </version >
9
+ <version >1.3.0 </version >
10
10
<packaging >jar</packaging >
11
11
12
12
<name >Labyrinth</name >
135
135
<dependency >
136
136
<groupId >com.github.the-h-team</groupId >
137
137
<artifactId >Enterprise</artifactId >
138
- <version >1.4 </version >
138
+ <version >1.5 </version >
139
139
<scope >compile</scope >
140
140
</dependency >
141
141
</dependencies >
Original file line number Diff line number Diff line change 9
9
public class Asynchronous {
10
10
11
11
private final BukkitRunnable runnable ;
12
-
12
+ private Applicable apply = null ;
13
13
private String cancel = null ;
14
-
15
14
private boolean check ;
16
-
17
15
private boolean fallback ;
18
-
19
16
private boolean debug ;
20
-
21
17
private Player p = null ;
22
18
23
19
protected Asynchronous (Applicable applicable ) {
@@ -40,6 +36,9 @@ public void run() {
40
36
}
41
37
}
42
38
applicable .apply ();
39
+ if (apply != null ) {
40
+ apply .apply ();
41
+ }
43
42
} else {
44
43
int count = Integer .parseInt (cancel );
45
44
count --;
@@ -59,6 +58,9 @@ public void run() {
59
58
}
60
59
}
61
60
applicable .apply ();
61
+ if (apply != null ) {
62
+ apply .apply ();
63
+ }
62
64
} else {
63
65
if (debug ) {
64
66
Labyrinth .getInstance ().getLogger ().info ("Closing task, max usage counter achieved." );
@@ -129,6 +131,20 @@ public Asynchronous debug() {
129
131
return this ;
130
132
}
131
133
134
+ /**
135
+ * Use this to apply defined logic to the runnable as soon as it finishes.
136
+ *
137
+ * <p>The information passed here will have secondary important and will be called
138
+ * directly after the initial runnable has executed one time for each time ran.</p>
139
+ *
140
+ * @param applicable The information to pass be it via Void or lambda reference.
141
+ * @return The same synchronous task builder.
142
+ */
143
+ public Asynchronous applyAfter (Applicable applicable ) {
144
+ this .apply = applicable ;
145
+ return this ;
146
+ }
147
+
132
148
/**
133
149
* Run this scheduled task on the very next tick.
134
150
*/
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ public class Synchronous {
10
10
11
11
private BukkitRunnable outer ;
12
12
private final BukkitRunnable runnable ;
13
+ private Applicable apply = null ;
13
14
private boolean check ;
14
15
private boolean debug ;
15
16
private boolean fallback ;
@@ -36,6 +37,9 @@ public void run() {
36
37
}
37
38
}
38
39
applicable .apply ();
40
+ if (apply != null ) {
41
+ apply .apply ();
42
+ }
39
43
} else {
40
44
int count = Integer .parseInt (cancel );
41
45
count --;
@@ -55,6 +59,9 @@ public void run() {
55
59
}
56
60
}
57
61
applicable .apply ();
62
+ if (apply != null ) {
63
+ apply .apply ();
64
+ }
58
65
} else {
59
66
if (debug ) {
60
67
Labyrinth .getInstance ().getLogger ().info ("Closing task, max usage counter achieved." );
@@ -138,6 +145,20 @@ public Synchronous debug() {
138
145
return this ;
139
146
}
140
147
148
+ /**
149
+ * Use this to apply defined logic to the runnable as soon as it finishes.
150
+ *
151
+ * <p>The information passed here will have secondary important and will be called
152
+ * directly after the initial runnable has executed one time for each time ran.</p>
153
+ *
154
+ * @param applicable The information to pass be it via Void or lambda reference.
155
+ * @return The same synchronous task builder.
156
+ */
157
+ public Synchronous applyAfter (Applicable applicable ) {
158
+ this .apply = applicable ;
159
+ return this ;
160
+ }
161
+
141
162
/**
142
163
* Run this scheduled task on the very next tick.
143
164
*/
Original file line number Diff line number Diff line change 1
1
name : Labyrinth
2
- version : 1.2.9
2
+ version : 1.3.0
3
3
main : com.github.sanctum.labyrinth.Labyrinth
4
4
prefix : Labyrinth
5
5
api-version : 1.13
You can’t perform that action at this time.
0 commit comments