mirror of
https://github.com/SimplexDevelopment/SimplexSS.git
synced 2024-11-15 06:03:32 +00:00
Update README.md
This commit is contained in:
parent
7e29987e7f
commit
5d66ea6582
17
README.md
17
README.md
@ -95,12 +95,29 @@
|
|||||||
scheduler.getServiceManager().subscribe(manager -> {
|
scheduler.getServiceManager().subscribe(manager -> {
|
||||||
manager.emptyBukkitServicePool("pool_name", this).subscribe(pool -> {
|
manager.emptyBukkitServicePool("pool_name", this).subscribe(pool -> {
|
||||||
Set<Disposable> dispos = new HashSet<>();
|
Set<Disposable> dispos = new HashSet<>();
|
||||||
|
|
||||||
firstService = new YourFirstService(pool, "first_service_name");
|
firstService = new YourFirstService(pool, "first_service_name");
|
||||||
secondService = new YourSecondService(pool, "second_service_name", 20 * 60L);
|
secondService = new YourSecondService(pool, "second_service_name", 20 * 60L);
|
||||||
thirdService = new YourThirdService(pool, "third_service_name", 20 * 60L, 20 * 60 * 10L, true, false);
|
thirdService = new YourThirdService(pool, "third_service_name", 20 * 60L, 20 * 60 * 10L, true, false);
|
||||||
|
|
||||||
scheduler.queue(firstService).subscribe(dispos::add);
|
scheduler.queue(firstService).subscribe(dispos::add);
|
||||||
scheduler.queue(secondService).subscribe(dispos::add);
|
scheduler.queue(secondService).subscribe(dispos::add);
|
||||||
scheduler.queue(thirdService).subscribe(dispos::add);
|
scheduler.queue(thirdService).subscribe(dispos::add);
|
||||||
|
|
||||||
|
disposables = Flux.fromIterable(dispos);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then stop, cancel, and/or dispose of the tasks in your `JavaPlugin#onDisable()` method by calling:
|
||||||
|
```Java
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
scheduler.getServiceManager().subscribe(manager -> {
|
||||||
|
manager.getServicePools().doOnEach(signal -> Objects.requireNonNull(signal.get())
|
||||||
|
.stopServices(disposables)
|
||||||
|
.subscribe());
|
||||||
|
});
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user