mirror of
https://github.com/plexusorg/Plex.git
synced 2024-10-31 17:17:12 +00:00
33 lines
1.2 KiB
Java
33 lines
1.2 KiB
Java
|
package dev.plex.util;
|
||
|
|
||
|
import com.google.common.io.ByteArrayDataOutput;
|
||
|
import com.google.common.io.ByteStreams;
|
||
|
import dev.plex.Plex;
|
||
|
import net.kyori.adventure.text.Component;
|
||
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||
|
import org.bukkit.Bukkit;
|
||
|
import org.bukkit.entity.Player;
|
||
|
|
||
|
public class BungeeUtil
|
||
|
{
|
||
|
public static boolean isBungeeCord()
|
||
|
{
|
||
|
return Bukkit.spigot().getSpigotConfig().getBoolean("settings.bungeecord");
|
||
|
}
|
||
|
|
||
|
public static boolean isVelocity()
|
||
|
{
|
||
|
return Bukkit.spigot().getPaperConfig().getBoolean("settings.velocity-support.enabled") && !Bukkit.spigot().getPaperConfig().getString("settings.velocity-support.secret", "").isEmpty();
|
||
|
}
|
||
|
|
||
|
public static void kickPlayer(Player player, Component message)
|
||
|
{
|
||
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||
|
out.writeUTF("KickPlayer");
|
||
|
out.writeUTF(player.getName());
|
||
|
out.writeUTF(LegacyComponentSerializer.legacySection().serialize(message));
|
||
|
player.sendPluginMessage(Plex.get(), "BungeeCord", out.toByteArray());
|
||
|
}
|
||
|
}
|