Coins

Discussion in 'Plugin Development' started by killerzz1, Nov 8, 2014.

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

    killerzz1

    Hey guys i am still kind of new to the bukkit api but i do know some things all i would like to know is how to make a currency for my server like coins and have it save in a config.yml file how would i do this i would like to be able to give money to a player when an event happens so if you could help me make an method for this that would be helpful thanks

    Oh one more thing i would also need an method to remove coins to thanks
     
  2. Offline

    Skionz

  3. Offline

    killerzz1

  4. Offline

    Skionz

    killerzz1 That shows all information about all of the methods for the JavaPlugin class and the FileConfiguration class.
     
  5. Offline

    killerzz1


    I know what it is and how to use it but i can't find all the info that i need
     
  6. Offline

    Skionz

    killerzz1 JavaPlugin#getConfig(), JavaPlugin#saveConfig(), FileConfiguration#get(), FileConfiguration#set(). Everything you need to know took me about 30 seconds to find.
     
  7. Offline

    killerzz1

    Ok so i have done this but when i join the server it is not changing anything in the config.yml


    Code:java
    1. private void giveMoney(Player p, int i) {
    2. getConfig().getDouble(p.getName() + ".money");
    3. }
    4.  
    5.  
    6. @EventHandler
    7. public void onJoin(PlayerJoinEvent e)
    8. {
    9. Player p = e.getPlayer();
    10.  
    11.  
    12. giveMoney(p, 1);
    13.  
    14. getConfig().set(p.getName() + ".money",
    15. getConfig().getInt(p.getName() + ".money"));
    16. saveConfig();
    17. }
     
  8. Offline

    Skionz

    killerzz1 the set method has 2 parameters
     
  9. Offline

    killerzz1

    Where about
     
  10. Offline

    Skionz

  11. Offline

    killerzz1

    I just said i don't understand them
     
  12. Offline

    Skionz

    killerzz1 What don't you understand? They tell you everything.
     
Thread Status:
Not open for further replies.

Share This Page