Vectrix / RXS

A ReactiveX wrapper for Sponge.
0
Download

RXS (ReactiveX for Sponge)

RXS is a ReactiveX wrapper over Sponge events and scheduler with a few common utilities.

Details

  • RxJava 1.3.8
  • SpongeAPI 7.1.0

Using

RXS is a plugin dependency that you can depend on with your plugin to use ReactiveX with Sponge. This also comes with a handy rxdebug command to toggle assembly tracking.

How to Use ReactiveX

ReactiveX Source

Example:

final RxSpongeScheduler syncScheduler = new RxSpongeScheduler(this, false);
final RxSpongeScheduler asyncScheduler = new RxSpongeScheduler(this, true);
final RxSpongeEventStreamer eventStreamer = new RxSpongeEventStreamer(this, syncScheduler, asyncScheduler);
final RxSpongePlayerStreamer playerStreamer = new RxSpongePlayerStreamer(this, syncScheduler, asyncScheduler);

eventStreamer.observeEvent(ClientConnectionEvent.Join.class)
                .subscribe(result -> result.getTargetEntity().sendMessage(Text.of("Hello there.")));

Credits

Category: Developer Tools

Published on May 5, 2019

209 views

0 stars

0 total downloads

Licensed under MIT

Pages

Members