Advertisement
riking

Untitled

May 2nd, 2014
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. // YAML code
  2.         for (final Entry<String, ConfigurationSection> entry : hero.getSkillSettings().entrySet()) {
  3.             for (final String key : entry.getValue().getKeys(true)) {
  4.                 if (entry.getValue().isConfigurationSection(key)) {
  5.                     continue;
  6.                 }
  7.                 config.set(entry.getKey() + "." + key, entry.getValue().get(key));
  8.             }
  9.         }
  10.  
  11. // WIP code
  12.             for (Entry<String, ConfigurationSection> entry : heroCopy.getSkillSettings().entrySet()) {
  13.                 YamlConfiguration config = new YamlConfiguration();
  14.                 for (String key : entry.getValue().getKeys(true)) {
  15.                     if (entry.getValue().isConfigurationSection(key)) {
  16.                         continue;
  17.                     }
  18.                     config.set(entry.getKey() + "." + key, entry.getValue().get(key));
  19.                 }
  20.  
  21.                 // this is deplorable. saving yaml to a database.
  22.                 // but there's no better way :( (or is there?)
  23.                 String toSave = config.saveToString();
  24.  
  25.                 // TODO
  26.                 // - check if existing row for entry.getKey()
  27.                 //  - overwrite if exists, insert if doesn't
  28.                 // - delete rows that don't have matching keys in getSkillSettings
  29.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement