From b2cf7dd6869b699658d7b1f8b7454b9acdd01899 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 7 Jul 2021 19:22:49 +0300 Subject: [PATCH] Ensure sending players is done synchronously --- .../huskhomes2/data/pluginmessage/PluginMessage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/william278/huskhomes2/data/pluginmessage/PluginMessage.java b/src/main/java/me/william278/huskhomes2/data/pluginmessage/PluginMessage.java index c5a8cd664..f4c255967 100644 --- a/src/main/java/me/william278/huskhomes2/data/pluginmessage/PluginMessage.java +++ b/src/main/java/me/william278/huskhomes2/data/pluginmessage/PluginMessage.java @@ -18,12 +18,12 @@ public class PluginMessage { // Move a player to a different server in the bungee network @SuppressWarnings("UnstableApiUsage") public static void sendPlayer(Player p, String targetServer) { - Bukkit.getScheduler().runTaskLater(plugin, () -> { + Bukkit.getScheduler().runTask(plugin, () -> { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(targetServer); p.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); - }, 1); + }); } private static final String MESSAGE_DATA_SEPARATOR = "$";