mirror of
https://github.com/arcadiadevs/hubcore.git
synced 2024-11-22 06:15:14 +01:00
Fixes
This commit is contained in:
parent
4eff81f493
commit
21d4f6a536
@ -134,7 +134,7 @@ public class PsHubCore extends JavaPlugin {
|
|||||||
spiGui = new SpiGUI(this);
|
spiGui = new SpiGUI(this);
|
||||||
|
|
||||||
// Initialize ServerCache
|
// Initialize ServerCache
|
||||||
serverCache = new ServerCache(serversController, getConfig());
|
serverCache = new ServerCache(serversController, getConfig(), this);
|
||||||
|
|
||||||
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", serverCache);
|
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", serverCache);
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import os.arcadiadevs.playerservers.hubcore.PsHubCore;
|
||||||
import os.arcadiadevs.playerservers.hubcore.controllers.ServersController;
|
import os.arcadiadevs.playerservers.hubcore.controllers.ServersController;
|
||||||
import os.arcadiadevs.playerservers.hubcore.dto.ServerRecord;
|
import os.arcadiadevs.playerservers.hubcore.dto.ServerRecord;
|
||||||
import os.arcadiadevs.playerservers.hubcore.utils.BungeeUtil;
|
import os.arcadiadevs.playerservers.hubcore.utils.BungeeUtil;
|
||||||
@ -27,10 +28,13 @@ public class ServerCache extends BukkitRunnable implements PluginMessageListener
|
|||||||
|
|
||||||
private final ServersController serversController;
|
private final ServersController serversController;
|
||||||
|
|
||||||
public ServerCache(ServersController serversController, FileConfiguration config) {
|
private final PsHubCore instance;
|
||||||
|
|
||||||
|
public ServerCache(ServersController serversController, FileConfiguration config, PsHubCore instance) {
|
||||||
this.serversController = serversController;
|
this.serversController = serversController;
|
||||||
this.servers = new ArrayList<>();
|
this.servers = new ArrayList<>();
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +43,7 @@ public class ServerCache extends BukkitRunnable implements PluginMessageListener
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (!this.isCancelled()) {
|
while (instance.isEnabled()) {
|
||||||
Player player = Bukkit.getOnlinePlayers().stream().findAny().orElse(null);
|
Player player = Bukkit.getOnlinePlayers().stream().findAny().orElse(null);
|
||||||
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user