Solved Sending a message as player

Discussion in 'Spigot Plugin Development' started by tomasekCZE, Aug 4, 2018.

  1. Hello, how can i send message as player with ChatComponentText?
     
  2. What do you mean send a message as a player?
     
  3. I think make it look like the player sent the message, in this case you would go with
    Code (Java):
    player.chat("Your text");
     
  4. Yes, but as i said I need ChatComponentText, no String
     
  5. I don't think that you can, have you ever seen it anywhere?

    Players themself can't send Json Message on their own so
     
  6. Code (Java):
    PlayerList h = MinecraftServer.getServer().getPlayerList();
              for (Player i : Bukkit.getOnlinePlayers()) {
                h.getPlayer(i.getName()).sendMessage(d);
              }
    this can send ChatComponentText for all players, but they will don't know from who
     
  7. How are the messages you're wanting to send originating? Are they coming from player input or a command or does your plugin generate the messages somehow otherwise and you just want it to appear as a player has said something?