.
This commit is contained in:
parent
e4fd6a8c5f
commit
d3e20606d9
10 changed files with 130 additions and 37 deletions
|
|
@ -3,6 +3,7 @@ package de.kentoj.scrow.bukkit;
|
|||
import de.kentoj.scrow.bukkit.crown.command.CrownCommand;
|
||||
import de.kentoj.scrow.bukkit.economy.CoinsCommand;
|
||||
import de.kentoj.scrow.bukkit.friends.command.FriendCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
|
|
@ -26,7 +27,8 @@ public class CoreImplPlugin extends JavaPlugin {
|
|||
}
|
||||
|
||||
private void registerServer() {
|
||||
ScrowAPI.getServerManager().updateState(System.getenv("SERVER_HANDLE"), "UP");
|
||||
ScrowAPI.getServerManager().updateState(System.getenv("SERVER_HANDLE"), "UP")
|
||||
.subscribe(__ -> Bukkit.getLogger().info("registered self"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -5,20 +5,21 @@ import de.kentoj.scrow.bukkit.ScrowAPI;
|
|||
import de.kentoj.scrow.bukkit.ServerManager;
|
||||
import io.nats.client.Connection;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bson.Document;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class CrownServerManager implements ServerManager {
|
||||
|
||||
private final Connection nats;
|
||||
private final
|
||||
|
||||
@Override
|
||||
public Mono<@NotNull String> deployServer(String template) {
|
||||
return Mono.fromFuture(nats.request("crown.deploy-server", template.getBytes()))
|
||||
return Mono.fromFuture(nats.request("crown.deploy-server", new Document()
|
||||
.append("template", template))
|
||||
.map(msg -> new String(msg.getData()));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue