2
I have a StringList
inside a file mensagens.txt
, I’d like to count how many lines there are StringList
contained within that file. For each line of the string 1 code will be executed within the plugin.
If the 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 him to take the number of lines StringList
and run automatically.