mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-05 12:40:27 +00:00
finishup bungeecord, move to mini message as serialzier
This commit is contained in:
@@ -5,11 +5,8 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
api(project(":RedisBungee-API"))
|
||||
compileOnly(libs.platform.bungeecord) {
|
||||
exclude("com.google.guava", "guava")
|
||||
exclude("com.google.code.gson", "gson")
|
||||
exclude("net.kyori","adventure-api")
|
||||
}
|
||||
compileOnly(libs.adventure.platforms.bungeecord)
|
||||
compileOnly(libs.platform.bungeecord)
|
||||
}
|
||||
|
||||
description = "RedisBungee Bungeecord API"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2013-present RedisBungee contributors
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
|
||||
package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
// this class used to redirect calls to keep the implementation and api separate
|
||||
public interface ApiPlatformSupport {
|
||||
|
||||
void kickPlayer(UUID player, Component message);
|
||||
|
||||
}
|
||||
@@ -11,6 +11,9 @@
|
||||
package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
||||
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;
|
||||
@@ -29,6 +32,8 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
|
||||
|
||||
private static RedisBungeeAPI redisBungeeApi;
|
||||
|
||||
private static final BungeeComponentSerializer BUNGEE_COMPONENT_SERIALIZER = BungeeComponentSerializer.get();
|
||||
|
||||
public RedisBungeeAPI(RedisBungeePlugin<?> plugin) {
|
||||
super(plugin);
|
||||
if (redisBungeeApi == null) {
|
||||
@@ -51,6 +56,52 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
|
||||
return ((Plugin) this.plugin).getProxy().getServerInfo(serverName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicks a player from the network
|
||||
* 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
|
||||
*
|
||||
* @param player player uuid
|
||||
* @param message kick message that player will see on kick
|
||||
* @since 0.13.0
|
||||
*/
|
||||
public void kickPlayer(UUID player, BaseComponent[] message) {
|
||||
kickPlayer(player, BUNGEE_COMPONENT_SERIALIZER.deserialize(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicks a player from the network
|
||||
* calls {@link #getUuidFromName(String)} to get uuid
|
||||
*
|
||||
* @param playerName player name
|
||||
* @param message kick message that player will see on kick
|
||||
* @since 0.12.0
|
||||
*/
|
||||
public void kickPlayer(String playerName, Component message) {
|
||||
kickPlayer(getUuidFromName(playerName), message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicks a player from the network
|
||||
*
|
||||
* @param player player uuid
|
||||
* @param message kick message that player will see on kick
|
||||
* @since 0.12.0
|
||||
*/
|
||||
public void kickPlayer(UUID player, Component message) {
|
||||
((ApiPlatformSupport) this.plugin).kickPlayer(player, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api instance
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user