Solved keySet() error

Discussion in 'Plugin Development' started by _MrDanya_, Aug 10, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    _MrDanya_

    Hello, when creating animations for ScoreBoard, I encountered the error " The method keySet() is undefined for the type Config ".

    This should work like this: Alternately, a line is taken from the file animation.txt and embedded in the animation.

    [​IMG]
    Text Code (open)
    Code:
    private static void loadAnimations() {
       animations.clear();
      
       HashMap temp = new HashMap();
       File anFile = new File(Main.getInstance().getDataFolder(), "animation.txt");
       if (!anFile.exists()) {
         Main.getInstance().saveResource("animation.txt", false);
       }
       List<String> contents = Files.readLines(anFile, Charset.forName("UTF-8"));
       String pointer = "";
       for (String s : contents) {
          if (s.startsWith("[") && s.endsWith("]")) {
          pointer = s.substring(1, s.length() - 1);
          temp.put(pointer, new ArrayList());
            continue;
          }
        ((List)temp.get(pointer)).add(s);
        }
       for (String k : keySet()) {
        Animation a = new Animation(k, (List)temp.get(k));
        animations.put(k, a);
        }
      }


    How can I fix this error? I’m rewriting an old, abandoned plugin in which it works.
    Thanks for any answers!
     
  2. Offline

    timtower Administrator Administrator Moderator

    @_MrDanya_ On what should the keySet be called? I assume on temp
     
Thread Status:
Not open for further replies.

Share This Page