Skip to content

Commit 3359c23

Browse files
committed
Project name finalize: Renamed to Reactant
1 parent b5a4266 commit 3359c23

File tree

173 files changed

+1218
-1322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+1218
-1322
lines changed

README.md

+5-122
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,14 @@
1-
# Swampium
1+
# Reactant
22

3-
Swampium core is a spigot plugin framework which provide a better way for developing spigot plugins.
4-
5-
Including:
6-
- Dependency injection
7-
- Service instance managing
8-
- Initialize order resolving
9-
- Defined common service interface (for example: economy, faction and configs)
10-
- and the utils that you need.
3+
Reactant core is a spigot plugin framework which provide a better way for developing spigot plugins.
114

125
## Build
136
If you would like to compile it yourself, clone the project and ensure you have JDK 8.
147

158
After that, use `./gradlew build` (`gradlew build` for windows) to start your build.
169

1710
You can find the compiled jars in `./build/libs`.
18-
Use `swampium-*-all.jar` which including the dependencies if you would like to load as spigot plugin.
19-
20-
## Quick start
21-
### Add as dependency
22-
For gradle:
23-
```groovy
24-
repositories {
25-
maven {
26-
url https://dl.bintray.com/setako/swamphut
27-
}
28-
}
29-
30-
dependencies {
31-
compileOnly "net.swamphut:swampium:0.0.2-rc"
32-
}
33-
```
34-
### Modify your plugin class
35-
Firstly, create your plugin just like a normal spigot plugin, and add Swampium as depend in your `plugin.yml`.
36-
```yaml
37-
depend:
38-
- Swampium
39-
```
40-
41-
Add a annotation `@SwampiumPlugin` on your plugin class, and tell swampium where to find your services.
42-
The following config will match `net.swamphut.demo.*`.
43-
```java
44-
@SwampiumPlugin(servicePackages = "net.swamphut.demo")
45-
public class DemoPlugin extends JavaPlugin {
46-
47-
}
48-
```
49-
If your services are in multiple packages:
50-
```java
51-
@SwampiumPlugin(servicePackages = {"com.otherpackage.test.demo", "net.swamphut.demo"})
52-
```
53-
54-
### Your first service
55-
We have defined a testing service interface called `HelloService`,
56-
let's use it to say hello when our service start.
57-
58-
59-
```java
60-
@SwObject
61-
@ServiceProvider
62-
public class DemoHelloService implements LifeCycleHook {
63-
64-
@Inject
65-
private HelloService helloService;
66-
67-
@Override
68-
public void init() {
69-
helloService.sayHello("demo");
70-
}
71-
}
72-
```
73-
74-
### Define a service interface
75-
Although swampium have define the most common features service interfaces,
76-
but you can define a new service interface as you wish.
77-
Don't forgot to create an issues if you found that we are missing an important interface.
78-
79-
Now we are going to define a simple messaging interface.
80-
Before we start working on it, we have to clearly understand what function should a messaging service have.
81-
As an example, we will just include some of them:
82-
- sendMessage(Player sender, Player receiver, String message)
83-
- getMessageSentHistory(Player sender);
84-
85-
Then, we have to analyze should it be an async method, if it should,
86-
then let's define its return type as `Observable`/`Single`/`Completable`
87-
88-
```java
89-
public interface ChattingService{
90-
Completable sendMessage(Player sender, Player receiver, String message);
91-
Single<List<String>> getMessageSentHistory(Player sender);
92-
//more definition...
93-
}
94-
```
95-
96-
After we defined the `ChattingService` interface,
97-
all service which have implements and providing it will be consider as an available `ChattingService`.
98-
99-
### Implement an service provider
100-
To implement an service interface, we have to use annotation `@ServiceProvider`,
101-
and declare which classes you are providing.
102-
103-
Assume that you have completed the above task, and defined a `ChattingService` interface,
104-
the tutorial is not going to show how to save the data, so we will not save the message here.
105-
```java
106-
@SwObject
107-
@ServiceProvider(provide = ChattingService.class)
108-
public class SimpleChattingService implements ChattingService{
109-
110-
//Since we are not going to introduce data saving here
111-
private Map<Player, List<String>> sentHistories = new HashMap<>();
112-
113-
@Override
114-
public Completable sendMessage(Player sender, Player receiver, String message){
115-
return Completable.fromAction(() -> {
116-
receiver.sendMessage("[" + sender + "]" + message);
117-
if (!sentHistories.containsKey(sender)){
118-
sentHistories.put(sender,new ArrayList<>());
119-
}
120-
sentHistories.get(sender).add(message);
121-
});
122-
}
123-
124-
@Override
125-
public Single<List<String>> getMessageSentHistory(Player sender){
126-
return Single.fromCallable(() -> sentHistories.getOrDefault(sender, new ArrayList<>()));
127-
}
128-
}
129-
```
11+
Use `Reactant-*-all.jar` which including the dependencies if you would like to load as spigot plugin.
13012

131-
Now `SimpleChattingService` can be inject as an `ChattingService`
13+
## Where should I start?
14+
[Click here to check our cookbook guide](https://reactant.gitlab.io/cookbook-dev/)

build.gradle.kts

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33
import java.net.URI
44

5-
group = "net.swamphut"
6-
version = "0.0.7"
5+
group = "io.reactant"
6+
version = "0.1.0"
77

88
val kotlinVersion = "1.3.31"
99

@@ -29,7 +29,7 @@ repositories {
2929
mavenCentral()
3030
maven { url = URI.create("https://hub.spigotmc.org/nexus/content/repositories/snapshots") }
3131
maven { url = URI.create("https://oss.sonatype.org/content/repositories/snapshots/") }
32-
maven { url = URI.create("https://dl.bintray.com/setako/swamphut") }
32+
maven { url = URI.create("https://dl.bintray.com/reactant/reactant") }
3333
maven { url = URI.create("https://repo.codemc.org/repository/maven-public") }
3434
}
3535

@@ -75,8 +75,8 @@ val sourcesJar by tasks.registering(Jar::class) {
7575
}
7676

7777
val shadowJar = (tasks["shadowJar"] as ShadowJar).apply {
78-
relocate("org.bstats", "net.swamphut.swampium.core")
79-
relocate("okhttp3", "net.swamphut.swampium.okhttp3")
78+
relocate("org.bstats", "io.reactant.reactant.core")
79+
relocate("okhttp3", "io.reactant.reactant.okhttp3")
8080
}
8181

8282
val deployPlugin by tasks.registering(Copy::class) {
@@ -116,9 +116,9 @@ bintray {
116116
publish = true
117117
override = true
118118
pkg.apply {
119-
repo = "swamphut"
119+
repo = "reactant"
120120
name = project.name
121121
setLicenses("GPL-3.0")
122-
vcsUrl = "https://github.com/SwampHut/Swampium.git"
122+
vcsUrl = "https://gitlab.com/reactant/reactant"
123123
}
124124
}

settings.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "swampium"
1+
rootProject.name = "reactant"

src/main/java/net/swamphut/swampium/core/PluginEventRegister.kt

-20
This file was deleted.

src/main/java/net/swamphut/swampium/core/Swampium.kt

-105
This file was deleted.

src/main/java/net/swamphut/swampium/core/commands/SwampiumCommandRegister.kt

-31
This file was deleted.

src/main/java/net/swamphut/swampium/core/commands/SwampiumPermissions.kt

-15
This file was deleted.

src/main/java/net/swamphut/swampium/core/commands/swobject/SwObjectCommand.kt

-17
This file was deleted.

src/main/java/net/swamphut/swampium/core/dependency/injection/lazy/LazyInjectionService.kt

-19
This file was deleted.

0 commit comments

Comments
 (0)