Bugfix Plugin Messaging Channel

This commit is contained in:
Jkobs
2022-01-27 00:58:22 +01:00
parent 051a858658
commit 87dd68d7cd
2 changed files with 21 additions and 13 deletions

View File

@@ -16,10 +16,10 @@ public class BCommand_Sender_Reciver {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream output = new DataOutputStream(stream);
try {
if (console){
if (console) {
output.writeUTF("T2Code-Console");
} else {
if (sender instanceof Player){
if (sender instanceof Player) {
output.writeUTF(sender.getName());
} else {
output.writeUTF("T2Code-Console");
@@ -29,7 +29,15 @@ public class BCommand_Sender_Reciver {
} catch (IOException e) {
e.printStackTrace();
}
Bukkit.getServer().sendPluginMessage(Main.plugin, "t2codealias:bungee", stream.toByteArray());
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendPluginMessage(Main.plugin, "t2codealias:bungee", stream.toByteArray());
}else {
for(Player player : Bukkit.getOnlinePlayers()){
player.sendPluginMessage(Main.plugin, "t2codealias:bungee", stream.toByteArray());
return;
}
}
}
}