(Problem) Loading Data from another plugin

Discussion in 'Plugin Development' started by Morgenss, Jul 3, 2014.

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

    Morgenss

    Hey guys,
    i have a problem loading a yml file from another plugin, AncientRPG in this case. Im trying to get the level of a player ( saved under: \plugins\AncientRPG\players).



    The code im using atm: ( also tried loading the configuration with an InputStram, same result)
    Code:java
    1. File file = new File(Bukkit.getPluginManager().getPlugin("AncientRPG").getDataFolder().getPath()+File.separator+"players"+File.separator+"Morgenss.yml");
    2. FileConfiguration theconfig = YamlConfiguration.loadConfiguration(file);
    3. getLogger().info(theconfig.getKeys(true).toString());


    I can access the file but it only shows me the one parent node ("PlayerData"). Heres the .yml:

    Code:
    PlayerData:
      ==: com.ancientshores.AncientRPG.PlayerData
      xpsystem:
        ==: com.ancientshores.AncientRPG.Experience.AncientRPGExperience
        level: 1
        xpname: Morgenss
        xp: 0
      manasystem:
        ==: com.ancientshores.AncientRPG.Mana.ManaSystem
        playername: Morgenss
        manareginterval: 3.0
        maxmana: 1000
        mana: 1000
        manareg: 20
      player: Morgenss
      racename: ''
      hpsystem:
        ==: com.ancientshores.AncientRPG.HP.AncientRPGHP
        hp: 600.0
        hpRegInterval: 3.0
        playername: Morgenss
        hpReg: 20.0
        maxhp: 600.0
      classlevels: {}
      className: standardclass
      stance: null
    
    It seems he stops reading the file after the ==: nodes ( like: ==: com.ancientshores.AncientRPG.PlayerData). Deleting those node lines fixes the problem and it can access the whole file. Sadly AncientRPG writes the file in this way and i have absolutely no idea how to overcome this barrier.


    Regards,
    Morgens
     
  2. Why not hook into the plugin and get the levels from there?
     
  3. Offline

    whitehooder

    Strange. When I run the exact same code it gives me this:
    Is there anything else you could add so that we might figure out what's wrong?
     
  4. Offline

    Morgenss

    That is indeed very weird. I dont know what additional information i could give you, i dont even know what causes the problem.

    I tried completly uninstalling and reinstalling AncientRpg, cause i thought my files might be corrupted in some way. Also tried writing a fresh empty plugin that does nothing else than loading the player.yml, still same result:
    Code:
    [14:16:17 INFO]: [TestAncient] Enabling TestAncient v1.0
    [14:16:17 INFO]: [TestAncient] [PlayerData]
    
    Tried hooking, but havent found a method that returns me information about a player. Im fairly new to plugin-development so i might have overseen it.
    @Edit: I found a method that returns me the information i need, but the file reading thing is still weird, would be nice to figure out why that is.
    Regards,
    Morgens
     
Thread Status:
Not open for further replies.

Share This Page