mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-05 12:40:27 +00:00
reimpl kick api using serialized messages instead, Move language to own module, depenedcies fixes
This commit is contained in:
@@ -5,6 +5,9 @@ plugins {
|
||||
dependencies {
|
||||
compileOnly(project(":RedisBungee-API"))
|
||||
implementation(libs.acf.core)
|
||||
compileOnly(libs.adventure.api)
|
||||
compileOnly(libs.adventure.miniMessage)
|
||||
compileOnly(libs.adventure.gson)
|
||||
}
|
||||
|
||||
description = "RedisBungee common commands"
|
||||
|
||||
@@ -33,16 +33,16 @@ public class CommandRedisBungeeDebug extends AdventureBaseCommand {
|
||||
@Description("kicks a player from the network by name")
|
||||
@Private
|
||||
public void kick(CommandIssuer issuer, String playerName) {
|
||||
|
||||
plugin.getAbstractRedisBungeeApi().kickPlayer(playerName, Component.text("debug kick"));
|
||||
String message = serializeMessage(Component.text("kicked using redisbungee api using name"));
|
||||
plugin.playerDataManager().serializedPlayerKick(plugin.getUuidTranslator().getTranslatedUuid(playerName, false), message);
|
||||
}
|
||||
|
||||
@Subcommand("kickByUUID")
|
||||
@Description("kicks a player from the network by UUID")
|
||||
@Private
|
||||
public void kick(CommandIssuer issuer, UUID uuid) {
|
||||
|
||||
plugin.getAbstractRedisBungeeApi().kickPlayer(uuid, Component.text("debug kick"));
|
||||
String message = serializeMessage(Component.text("kicked using redisbungee api using uuid"));
|
||||
plugin.playerDataManager().serializedPlayerKick(uuid, message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,14 +13,21 @@ package com.imaginarycode.minecraft.redisbungee.commands.utils;
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
/**
|
||||
* this just dumb class that wraps the adventure stuff into base command
|
||||
*/
|
||||
public abstract class AdventureBaseCommand extends BaseCommand {
|
||||
|
||||
public static void sendMessage(CommandIssuer issuer, Component component) {
|
||||
protected void sendMessage(CommandIssuer issuer, Component component) {
|
||||
CommandPlatformHelper.getPlatformHelper().sendMessage(issuer, component);
|
||||
}
|
||||
|
||||
private static final GsonComponentSerializer COMPONENT_SERIALIZER = GsonComponentSerializer.gson();
|
||||
|
||||
protected String serializeMessage(Component message) {
|
||||
return COMPONENT_SERIALIZER.serialize(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user