3.0.0-SNAPSHOT-#1

This commit is contained in:
2022-11-03 19:15:07 +01:00
parent 758d5e7a8d
commit d9206e63a7
30 changed files with 555 additions and 239 deletions

View File

@@ -0,0 +1,41 @@
package net.t2code.opsecurity.system;
import net.t2code.opsecurity.events.Events;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import java.io.*;
public class BungeeSenderReceiver implements PluginMessageListener {
public static void sendToBungee(String information) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream output = new DataOutputStream(stream);
try {
output.writeUTF(information.toString());
} catch (IOException e) {
e.printStackTrace();
}
for (Player player : Bukkit.getOnlinePlayers()) {
player.sendPluginMessage(Main.getPlugin(), "t2c:opsec", stream.toByteArray());
return;
}
}
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
T2Csend.debug(Main.getPlugin(), "stream: " + stream.toString());
try {
String subChannel = stream.readUTF();
String information = stream.readUTF();
if (subChannel.equals("T2Cconsole")) {
Events.notifyPlayer(information);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}