try to replace %p and %p from a string

Discussion in 'Plugin Development' started by bennie3211, Jun 12, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    bennie3211

    Hi all, i dont think this is a bukkit problem, but when i use the replace function to replace %k to the killers name, I get an error that i cant use that method again :S

    This is what I use:

    Code:
    for (Player p : Bukkit.getServer().getOnlinePlayers())
                    {
                        if (plugin.kills.containsKey(p.getName()))
                        {
                            String broadcast = plugin.getConfig().getString("language.death-message-broadcast");
                            String broadcast1 = broadcast.replace("%p", player.getName());
                            String broadcast2 = broadcast1.replace("%k", player.getKiller());
                            p.sendMessage(prefix + broadcast2);
                        }
                    }
    The second .replace gives this error, anyone who can help me?
     
  2. Offline

    Suraski

    What's the error? It could be several things...
     
  3. Offline

    Me4502

    player.getKiller().getType().name() firstly, also check if getKiller() is null.
     
Thread Status:
Not open for further replies.

Share This Page