test message command
parent
e4b1ba7b0d
commit
8016d9d62f
|
@ -10,6 +10,7 @@ import java.util.Arrays;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import net.krakatoa.proxy.command.CodeCommand;
|
import net.krakatoa.proxy.command.CodeCommand;
|
||||||
|
import net.krakatoa.proxy.command.SendTestMessageCommand;
|
||||||
import net.krakatoa.proxy.config.ConfigHandler;
|
import net.krakatoa.proxy.config.ConfigHandler;
|
||||||
import net.krakatoa.proxy.listener.PlayerDisconnectListener;
|
import net.krakatoa.proxy.listener.PlayerDisconnectListener;
|
||||||
import net.krakatoa.proxy.listener.PostLoginListener;
|
import net.krakatoa.proxy.listener.PostLoginListener;
|
||||||
|
@ -93,16 +94,15 @@ public class ProxySystem extends Plugin {
|
||||||
|
|
||||||
public void loadCommands() {
|
public void loadCommands() {
|
||||||
PluginManager pluginManager = getProxy().getPluginManager();
|
PluginManager pluginManager = getProxy().getPluginManager();
|
||||||
Arrays.asList(new CodeCommand("code")).forEach(listener -> {
|
Arrays.asList(new CodeCommand("code"), new SendTestMessageCommand("sendTestMessage"))
|
||||||
pluginManager.registerCommand(this, listener);
|
.forEach(listener -> {
|
||||||
});
|
pluginManager.registerCommand(this, listener);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: proxy ping & join only accessible for 1.17.1 clients
|
TODO: proxy ping & join only accessible for 1.17.1 clients
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package net.krakatoa.proxy.command;
|
||||||
|
|
||||||
|
import earth.krakatao.protocol.KraSocketClientProtocolMessage;
|
||||||
|
import net.krakatoa.proxy.ProxySystem;
|
||||||
|
import net.md_5.bungee.api.CommandSender;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
|
|
||||||
|
public class SendTestMessageCommand extends Command {
|
||||||
|
|
||||||
|
public SendTestMessageCommand(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender commandSender, String[] args) {
|
||||||
|
if (commandSender instanceof ProxiedPlayer) {
|
||||||
|
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) commandSender;
|
||||||
|
|
||||||
|
// /sendTestMessage <status> <dest> <cmdNumber> <msg>
|
||||||
|
|
||||||
|
if (args.length == 4) {
|
||||||
|
KraSocketClientProtocolMessage kraSocketClientProtocolMessage = new KraSocketClientProtocolMessage(
|
||||||
|
Byte.parseByte(args[0]), 0, Integer.parseInt(args[1]),
|
||||||
|
proxiedPlayer.getUniqueId().toString(), Short.parseShort(args[2]), args[3]);
|
||||||
|
|
||||||
|
ProxySystem.getInstance().getKraSocketClient().getSocketClient()
|
||||||
|
.SendMessage(kraSocketClientProtocolMessage);
|
||||||
|
} else {
|
||||||
|
proxiedPlayer.sendMessage(new TextComponent(
|
||||||
|
"§cVerwendung: §7/sendTestMessage <status> <dest> <cmdNumber> <msg>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue