mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 14:38:53 +00:00
Move sending player cross server to a 1-tick delayed task and suppress beta warnings
This commit is contained in:
1 parent
f6dba0d317
commit
d5427d76c7
1 file changed
+9
-4
@@ -16,11 +16,14 @@ public class PluginMessage {
|
|||||||
private static final HuskHomes plugin = HuskHomes.getInstance();
|
private static final HuskHomes plugin = HuskHomes.getInstance();
|
||||||
|
|
||||||
// Move a player to a different server in the bungee network
|
// Move a player to a different server in the bungee network
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public static void sendPlayer(Player p, String targetServer) {
|
public static void sendPlayer(Player p, String targetServer) {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||||
out.writeUTF("Connect");
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF(targetServer);
|
out.writeUTF("Connect");
|
||||||
p.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
out.writeUTF(targetServer);
|
||||||
|
p.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||||
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String MESSAGE_DATA_SEPARATOR = "$";
|
private static final String MESSAGE_DATA_SEPARATOR = "$";
|
||||||
@@ -77,6 +80,7 @@ public class PluginMessage {
|
|||||||
* Send the plugin message
|
* Send the plugin message
|
||||||
* @param sender The player to send the message
|
* @param sender The player to send the message
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public void send(Player sender) {
|
public void send(Player sender) {
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
@@ -111,6 +115,7 @@ public class PluginMessage {
|
|||||||
sendToServer(sender, "ALL");
|
sendToServer(sender, "ALL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public void sendToServer(Player sender, String server) {
|
public void sendToServer(Player sender, String server) {
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
|
|||||||
Reference in new issue
Block a user