I'm very new to coding. I have tried everything.I can think of to try to get a list of titles that are stored in my config to be sent to the player as messages and nothing I have tried works.
current config setup referenced
players:
player1name:
- title1
- title2
- title3
player2name:
- title1
- title3
call to send message code line
if (args.length == 2) {
try {
// insert code here to display titles list available
// to
// player
Player p = Bukkit.getPlayer(args[1]);
if (p == null) {
sender.sendMessage("Could Not Find Player!!");
return true;
}
Bukkit.broadcastMessage("I got to this point pre- list");
List<String> s = this.Ach.getConfig()
.getStringList("players." + p + "titles");
StringBuilder message = new StringBuilder();
Bukkit.broadcastMessage("I got to this point post message");
for (String players : s) {
message.append(players).append(" - ");
Bukkit.broadcastMessage("I got to this point post for");
sender.sendMessage(message.toString()); // (message.toString());
}
// Set<String> keys =
// this.Ach.getConfig().getConfigurationSection("player."
// + p + "titles").getKeys(false);
// sender.sendMessage(keys + " - ");
Bukkit.broadcastMessage("I got to this point pre return");
return true;}
catch (Exception e) {
e.printStackTrace();
}
`Ach' is defined earlier to reference my main class that get config is defined in.
what I expect to be outputed with player1name
as the args[1]
value
title1 - title2 - title3 -
with a valid player name instead of returning the titles the player has, all I'm getting sent to chat is
[] -
any help would be greatly appreciated.