36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
package net.t2code.alias.Spigot.system;
|
|
|
|
import net.t2code.alias.Spigot.Main;
|
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.DataOutputStream;
|
|
import java.io.IOException;
|
|
|
|
public class BCommand_Sender_Reciver {
|
|
|
|
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
|
DataOutputStream output = new DataOutputStream(stream);
|
|
try {
|
|
if (console){
|
|
output.writeUTF("T2Code-Console");
|
|
} else {
|
|
if (sender instanceof Player){
|
|
output.writeUTF(sender.getName());
|
|
} else {
|
|
output.writeUTF("T2Code-Console");
|
|
}
|
|
}
|
|
output.writeUTF(information);
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
Bukkit.getServer().sendPluginMessage(Main.plugin, "t2codealias:bungee", stream.toByteArray());
|
|
}
|
|
|
|
}
|