Saving kills to a config!?

Discussion in 'Plugin Development' started by Schaakmatth, May 18, 2014.

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

    Schaakmatth

    hello i want to save all the player kills to a config
    but when im testing it out it wont make a config.yml
    HELP!
    Code:java
    1.  
    2. @Override
    3. public void onEnable() {
    4. this.logger.info("[ChatDelay] On!");
    5. getServer().getPluginManager().registerEvents(this, this);
    6. }
    7.  
    8.  
    9. @Override
    10. public void onDisable() {
    11. this.logger.info("[ChatDelay] Off!");
    12.  
    13. }
    14.  
    15. @EventHandler
    16. public void onKill(PlayerDeathEvent e) {
    17. String Killer = e.getEntity().getKiller().getName();
    18. int killCount = getConfig().getInt("Players." + Killer + ".Kills") +1;
    19. getConfig().set("Players." + Killer + ".Kills", killCount);
    20. this.saveConfig();
    21. this.reloadConfig();
    22. }
    23. }


    my config file:
    Code:
    # Configuration
    
     
  2. Schaakmatth do you study java? or study to "play" with bukkit?
     
  3. Offline

    Azubuso

    Schaakmatth In your onEnable, add in
    PHP:
    getConfig().options().copyDefaults(true);
    And
    PHP:
    saveConfig();
     
Thread Status:
Not open for further replies.

Share This Page