From 7e2d382152958fa70caebc8a689e60b742abd0e9 Mon Sep 17 00:00:00 2001 From: SkyWatcher_2019 Date: Mon, 4 Sep 2023 16:40:18 +0300 Subject: [PATCH] Check if server is null --- src/main/java/net/elytrium/limboqueue/LimboQueue.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/elytrium/limboqueue/LimboQueue.java b/src/main/java/net/elytrium/limboqueue/LimboQueue.java index a361062..2eae365 100644 --- a/src/main/java/net/elytrium/limboqueue/LimboQueue.java +++ b/src/main/java/net/elytrium/limboqueue/LimboQueue.java @@ -123,9 +123,11 @@ public void reload() { manager.register("limboqueue", new LimboQueueCommand(this), "lq", "queue"); Optional 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) {