Skip to content

Commit

Permalink
Check if server is null
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyWatcher2019 committed Sep 4, 2023
1 parent f70e784 commit 7e2d382
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/net/elytrium/limboqueue/LimboQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ public void reload() {
manager.register("limboqueue", new LimboQueueCommand(this), "lq", "queue");

Optional<RegisteredServer> server = this.getServer().getServer(Config.IMP.MAIN.SERVER);
server.ifPresent(registeredServer -> this.targetServer = registeredServer);
this.startPingTask();
this.startQueueTask();
server.ifPresentOrElse(registeredServer -> {
this.targetServer = registeredServer;
this.startPingTask();
this.startQueueTask();
}, () -> LOGGER.error("Server " + Config.IMP.MAIN.SERVER + " doesn't exists!"));
}

public void queuePlayer(Player player) {
Expand Down

0 comments on commit 7e2d382

Please sign in to comment.