2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-08 22:18:02 +00:00

add bungeecord specific kick api

This commit is contained in:
mohammed jasem alaajel 2024-05-14 21:45:59 +04:00
parent 31699e3660
commit 892db93cb1
Signed by: ham1255
GPG Key ID: EF343502046229F4
2 changed files with 27 additions and 1 deletions

View File

@ -10,6 +10,7 @@ dependencies {
exclude("com.google.code.gson", "gson")
exclude("net.kyori","adventure-api")
}
compileOnly(libs.adventure.platforms.bungeecord)
}
description = "RedisBungee Bungeecord API"

View File

@ -13,7 +13,8 @@ package com.imaginarycode.minecraft.redisbungee;
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode;
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisPooledSummoner;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.plugin.Plugin;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -56,6 +57,30 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
return ((Plugin) this.plugin).getProxy().getServerInfo(serverName);
}
/**
* Kicks a player from the network but with bungeecord chat Component system
* calls {@link #getUuidFromName(String)} to get uuid
*
* @param playerName player name
* @param message kick message that player will see on kick
* @since 0.13.0
*/
public void kickPlayer(String playerName, BaseComponent[] message) {
kickPlayer(getUuidFromName(playerName), message);
}
/**
* Kicks a player from the network but with bungeecord chat Component system
*
* @param playerUUID player name
* @param message kick message that player will see on kick
* @since 0.13.0
*/
public void kickPlayer(UUID playerUUID, BaseComponent[] message) {
kickPlayer(playerUUID, BungeeComponentSerializer.get().deserialize(message));
}
// LEGACY API FOR BACKWARD COMPATIBILITY
/**