I have a StringList
inside a mensagens.txt
file, I would like to count how many rows have this StringList
contained within that file. For each line of the string 1 code will be run in plugin code.
If StringList
has 10 lines the code will execute:
web.setScore(1) para a linha 1
web.setScore(2) para a linha 2.....
web.setScore(10) para a linha 10
The code I created is this:
public class ScoreBoard implements Listener {
@EventHandler
public void pj(PlayerJoinEvent e) {
for (String list : Main.getMensagens().getStringList("Scoreboard")) {;
Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
Objective obj = scoreboard.registerNewObjective(Main.getMensagens().getString("Titulo"), "dummy");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score web = obj.getScore(list);
web.setScore(1);
Player p = e.getPlayer();
p.setScoreboard(scoreboard);
}
}
}
My problem is with web.setScore
, I need it to take the number of lines StringList
and run automatically.