1.14.4 Save Strings with <player_name> inside

Discussion in 'Spigot Plugin Development' started by petrux25, Feb 20, 2020.

  1. Hi guys, I have to save some messages, I think the best way to do it is using the config.yml and loading the messages every time the server starts. But if in these messages I have to insert the player name? for example: "<player> killed <player>"? How can I do it?
  2. text.replace("<player>", player.getName());
    • Like Like x 1
  3. I think you mean <attacker> killed <victim>, In minecraft you are not allowed to attack/kill yourself.
    So make them different variables.
    Code (Text):
    String attacker = text.replace("<attacker>", attacker.getName());
    String victim = text.replace("<victim>", attacker.getName());