File tree Expand file tree Collapse file tree 6 files changed +74
-3
lines changed
src/main/java/dev/klash/caramel/registry Expand file tree Collapse file tree 6 files changed +74
-3
lines changed Original file line number Diff line number Diff line change 2727 uses : softprops/action-gh-release@v2
2828 with :
2929 tag_name : " latest-1.21.4"
30- name : " [1.4.1 for 1.21.4] Development Build"
30+ name : " [1.4.2 for 1.21.4] Development Build"
3131 body : " Push-ly development build for Caramel. Updated on every push - ignore the 'commits to master since this release', github works weird."
3232 prerelease : false
3333 files : |
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Caramel is a multipurpose AIO api for PaperAPI plugins. ***Caramel can not and w
2424<dependency >
2525 <groupId >dev.klash</groupId >
2626 <artifactId >Caramel</artifactId >
27- <version >1.4.0 </version >
27+ <version >1.4.2 </version >
2828 <scope >provided</scope >
2929</dependency >
3030```
Original file line number Diff line number Diff line change 66
77 <groupId >dev.klash</groupId >
88 <artifactId >Caramel</artifactId >
9- <version >1.4.1 </version >
9+ <version >1.4.2 </version >
1010 <packaging >jar</packaging >
1111
1212 <name >Caramel</name >
Original file line number Diff line number Diff line change 1+ package dev .klash .caramel .registry ;
2+
3+ import java .util .ArrayList ;
4+ import java .util .List ;
5+
6+ public abstract class DuoRegistry <T > {
7+ public List <T > registry ;
8+ public DuoRegistry (T ...items ) {
9+ registry = new ArrayList <>(List .of (items ));
10+ }
11+ public abstract void taskA (T item );
12+ public abstract void taskB (T item );
13+ public final void callA () {
14+ for (T item : registry ) {
15+ taskA (item );
16+ }
17+ }
18+ public final void callB () {
19+ for (T item : registry ) {
20+ taskB (item );
21+ }
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ package dev .klash .caramel .registry ;
2+
3+ import java .util .ArrayList ;
4+ import java .util .List ;
5+
6+ public abstract class Registry <T > {
7+ public List <T > registry ;
8+ public Registry (T ...items ) {
9+ registry = new ArrayList <>(List .of (items ));
10+ }
11+ public abstract void task (T item );
12+ public final void call () {
13+ for (T item : registry ) {
14+ task (item );
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ package dev .klash .caramel .registry ;
2+
3+ import dev .klash .caramel .Caramel ;
4+ import dev .klash .caramel .CaramelCommandList ;
5+ import dev .klash .caramel .commands .CaramelCommand ;
6+
7+ public class SimpleCommandRegistry extends DuoRegistry <CaramelCommand > {
8+
9+ private CaramelCommandList list ;
10+
11+ @ Override
12+ public void taskA (CaramelCommand item ) {
13+ list .register (item );
14+ }
15+
16+ @ Override
17+ public void taskB (CaramelCommand item ) {
18+ list .getCommandList ().remove (item );
19+ }
20+
21+ public SimpleCommandRegistry (CaramelCommandList list , CaramelCommand ... commands ) {
22+ super (commands );
23+ this .list = list ;
24+ }
25+ public void register () {
26+ callA ();
27+ }
28+ public void unregister () {
29+ callB ();
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments