mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-28 22:46:40 +00:00
add plugin messaging to proxies for kicking players
This commit is contained in:
32
server/src/main/java/dev/plex/util/BungeeUtil.java
Normal file
32
server/src/main/java/dev/plex/util/BungeeUtil.java
Normal file
@ -0,0 +1,32 @@
|
||||
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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user