Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/felixklauke/caroline

Introduce RxJava into spigot and bungeecord on enterprise level. Also provides full feature binding adapters for spigot events, commands and protocollib packet adapters to bring spigot and bungeecord development with reactive pattern onto a new stage.
https://github.com/felixklauke/caroline

adapter binding command events library protocollib rxjava rxjava2 spigot

Last synced: 2 months ago
JSON representation

Introduce RxJava into spigot and bungeecord on enterprise level. Also provides full feature binding adapters for spigot events, commands and protocollib packet adapters to bring spigot and bungeecord development with reactive pattern onto a new stage.

Awesome Lists containing this project

README

        

# caroline

Ever tried using the java version of the reactive extensions ( https://github.com/ReactiveX/RxJava ) in a minecraft
bukkit server? Yes? Then you may know what this is and why you need it. Without any modifications its very
unlikely that your server will run very long. Using this pluginManager you can schedule rx javas internal thread architecture
on bukkit schedulers to make rxjava usable in general. Have fun using this.

# Build Status
| | Build Status | Test Code Coverage |
|------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Master | [![Build Status](https://travis-ci.org/FelixKlauke/caroline.svg?branch=master)](https://travis-ci.org/FelixKlauke/caroline) | [![codecov](https://codecov.io/gh/FelixKlauke/caroline/branch/master/graph/badge.svg)](https://codecov.io/gh/FelixKlauke/caroline) |
| Development | [![Build Status](https://travis-ci.org/FelixKlauke/caroline.svg?branch=dev)](https://travis-ci.org/FelixKlauke/caroline) | [![codecov](https://codecov.io/gh/FelixKlauke/caroline/branch/dev/graph/badge.svg)](https://codecov.io/gh/FelixKlauke/caroline) |

# Usage
- Install [Maven](http://maven.apache.org/download.cgi)
- Clone this repo
- Install: ```mvn clean install```

**Maven repositories**
```xml



klauke-enterprises-maven-releases
Klauke Enterprises Maven Releases
https://repository.klauke-enterprises.com/repository/maven-releases/




klauke-enterprises-maven-snapshots
Klauke Enterprises Maven Snapshots
https://repository.klauke-enterprises.com/repository/maven-snapshots/

```

**Maven dependencies**

_Caroline Core:_
```xml

de.felixklauke.caroline
caroline-core
1.2.0

```
# Example

## Event Example

_Plain old listener:_
```java
RxCaroline.observeEvent(PlayerJoinEvent.class).subscribe(event -> {
event.setJoinMessage("A new player joined: " + event.getPlayer().getName());
});
```

_Use a specific priority:_
```java
RxCaroline.observeEvent(PlayerJoinEvent.class, EventPriority.LOWEST).subscribe(event -> {
event.setJoinMessage("A new player joined: " + event.getPlayer().getName());
});
```

_Ignore cancelled events:_
```java
RxCaroline.observeEvent(PlayerJoinEvent.class, true).subscribe(event -> {
event.setJoinMessage("A new player joined: " + event.getPlayer().getName());
});
```

_Both at the same time:_
```java
RxCaroline.observeEvent(PlayerJoinEvent.class, EventPriority.LOWEST, true).subscribe(event -> {
event.setJoinMessage("A new player joined: " + event.getPlayer().getName());
});
```

## Command Example

## Packet Adapter example

# Architecture
We use google guice ( https://github.com/google/guice ) for dependency injection. You should have a look at that
before you consider touching our architecture. The guice dependencies are defined in the
`CarolineModule`. The bukkit pluginManager will create an instance of the main
application using the guice injector. The main application will hook our schedulers into rx java. Currently
we support
- Computation Scheduler (synchronous)
- IO Scheduler (asynchronous)
- New Thread Scheduler (asynchronous)
and configure rx java to use them. The tasks executed by these scheduler will be mapped on bukkits internal
scheduler architecture.