mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 14:38:49 +00:00
Handle failed player list gathering
This commit is contained in:
1 parent
7b52114cf5
commit
b3fea81135
1 file changed
+17
-4
@@ -68,6 +68,8 @@ import org.bukkit.command.ConsoleCommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.plugin.messaging.ChannelNotRegisteredException;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -145,12 +147,23 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
|
|||||||
|
|
||||||
this.messageManager = new MessageManager(this, messageService);
|
this.messageManager = new MessageManager(this, messageService);
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||||
BungeeChannelApi.of(this).getPlayerList("ALL")
|
BungeeChannelApi.of(CarbonChatBukkit.this).getPlayerList("ALL")
|
||||||
.thenAccept(value -> this.proxyPlayerNames = value);
|
.thenAccept(value -> CarbonChatBukkit.this.proxyPlayerNames = value);
|
||||||
}
|
}
|
||||||
}, 1, 5 * 20); // 5 seconds * 20 ticks per second
|
} catch (final ChannelNotRegisteredException exception) {
|
||||||
|
CarbonChatBukkit.this.logger().info("Exception thrown when gathering proxy player list!");
|
||||||
|
CarbonChatBukkit.this.logger().info("Aborting attempts to communicate to the proxy.");
|
||||||
|
CarbonChatBukkit.this.logger().info("This is merely for command completions, don't worry.");
|
||||||
|
|
||||||
|
this.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskTimer(this, 1, 5*20);
|
||||||
|
|
||||||
// Handle storage service
|
// Handle storage service
|
||||||
final StorageType storageType = this.carbonSettings().storageType();
|
final StorageType storageType = this.carbonSettings().storageType();
|
||||||
|
|||||||
Reference in new issue
Block a user