replace stringlist scoreboard error HELP

Discussion in 'Spigot Plugin Development' started by ElbestHD, Nov 28, 2018.

  1. Hello, good afternoon spigot people, I have a problem since I create a 100% editable scoreboard for the config.yml but when I put line.replace ("% kills%", kills) it does not work for me as it happens with the name and the deahts less with the sign of the colors that works if I leave here the code plus a picture of how I get the scoreboard and the console I get no error

    Code (Text):
    import java.util.List;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.event.player.PlayerQuitEvent;
    import com.elbesthd.buildffa.Main;
    import com.elbesthd.buildffa.utils.CreateData;

    public class ScoreboardManager
        implements Listener {
        private Main plugin;

        public ScoreboardManager(Main plugin) {
            this.plugin = plugin;
        public void onPlayerJoinEvent(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            CreateData data = CreateData.getConfig();
            String uuid = p.getUniqueId().toString();
            String kills = data.getString("Players." + uuid + ".Kills");
            String deaths = data.getString("Players." + uuid + ".Deaths");
            ScoreHelper helper = ScoreHelper.createScore(p);
            helper.setTitle(Main.get().getConfig().getString("Scoreboard.title").replace("&", "§"));
            List<String> list = Main.get().getConfig().getStringList("Scoreboard.wait");
            int nize = list.size() +1;
            for (String line : list) {
                setSlot(nize, list);
                line.replace("<Kills>", kills)
                    .replace("&", "§");

        private void setSlot(int nize, List<String> list) {

        public void onPlayerQuitEvent(PlayerQuitEvent e) {
            Player p = e.getPlayer();
            if (ScoreHelper.hasScore(p)) {

  2. Isn't the data kills and deaths a int so it would be grabbing a number and you are grabbing a string, when you should be grabbing a int then converting to a string when grabbing the placeholder?
  3. not,

    but that error happens to me with replace ("% name%", p.getName ()); I also get that
  4. How are you replacing it?, because in your code it seems that it is "<kills>" and your scoreboard shows "%kills%", by the way I recommend using
    Code (Java):
    ChatColor.translateAlternateColorCodes('&', exampleText);
    Hablo español por si es mas fácil para ti :), también tengo un complemento de FFA y estoy trabajando en uno muy bueno próximamente, si necesitas ayuda puedes decirme, no tengo molestia en ayudar.
  5. TheJavaHacker


    No. Don't speak Spanish. This is an English forums where English is the required language.
  6. I know, but it's to have a better communication, it will not complicate your life, the solution to your problem will be here, I'm just looking to help.

    Code (YAML):
    Keep content in English as much as possible.
    Please use a translating service to translate your content before posting if you are unable to speak English.
    English speaking users should be kind and courteous to other users who aren’t as fluent in English. Deliberately harassing the user for a lack of English proficiency is not permitted.
  7. TheJavaHacker


    English is the primary language of the forums and its against the rules to speak another language.
  8. From what I see, the rules do not mention that it is forbidden, only that it is avoided, and I prefer to focus on the main issue of the problem, please.