Skip to content

Commit

Permalink
YamlConfiguration returns an empty list with getStringList instead of…
Browse files Browse the repository at this point in the history
… null...
  • Loading branch information
RoboMWM committed Feb 26, 2017
1 parent cdfd9f6 commit 6854621
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/java/to/us/tf/DeathSpectating/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,11 @@ public class ConfigManager
ConfigurationSection titleSection = config.getConfigurationSection("titleMessages");
if (titleSection == null)
titleSection = config.createSection("titleMessages");

List<String> titles = new ArrayList<String>(Arrays.asList("&cYou died!", "&cGame over!"));
List<String> subTitles = new ArrayList<String>(Arrays.asList("Respawning in {0}", "Score: &e{1}", "Score: &e{1}&f, Respawning in {0}"));
if (titleSection.getStringList("titles") == null)
titleSection.set("titles", titles);
instance.getLogger().info(titleSection.getStringList("titles").get(0));
if (titleSection.getStringList("subtitles") == null)
titleSection.set("subtitles", subTitles);

if (titleSection.getStringList("titles").isEmpty())
titleSection.set("titles", new ArrayList<String>(Arrays.asList("&cYou died!", "&cGame over!")));
if (titleSection.getStringList("subtitles").isEmpty())
titleSection.set("subtitles", new ArrayList<String>(Arrays.asList("Respawning in {0}", "Score: &e{1}", "Score: &e{1}&f, Respawning in {0}")));

instance.saveConfig();
}
Expand Down

0 comments on commit 6854621

Please sign in to comment.