Skip to content

Commit ca706d0

Browse files
committed
1.4.2
1 parent 9da1d90 commit ca706d0

File tree

6 files changed

+74
-3
lines changed

6 files changed

+74
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
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: |

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

0 commit comments

Comments
 (0)