2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 10:38:01 +00:00

add bungeecord specific kick api

This commit is contained in:
mohammed jasem alaajel 2024-05-14 21:45:59 +04:00 committed by Mohammed Alteneiji
parent 612a28550f
commit 372c41d652
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
/**