how would i make a point system ...

Discussion in 'Plugin Development' started by ahuby09, Feb 5, 2014.

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

    ahuby09

    i want to make a point system so that it generates a config file with
    player-name: points

    after this i want to be ablke to add one when a certain event happens ( i only need to know how to add points)
    so please can you help me - thanks in advance
     
  2. Offline

    ThePlayerPaul

    Where do you need help?
     
  3. Offline

    ahuby09

    the making off the config and adding one every time a certain event takes place
     
  4. Offline

    ThePlayerPaul

    Code:java
    1. public void addPoints(Player p, int amount) {
    2.  
    3. if(getConfig().getString("Player." + p.getName()) == null) {
    4. getConfig().set("Player." + p.getName(), amount);
    5. saveConfig();
    6. }else{
    7. int a = getConfig().getInt("Spieler." + p.getName());
    8. getConfig().set("Player." + p.getName(), a + amount);
    9. saveConfig();
    10. }
    11.  
    12. }
    13. //Remove
    14. public void removePoints(Player p, int amount) {
    15.  
    16. if(getConfig().getString("Player." + p.getName()) == null) {
    17. getConfig().set("Player." + p.getName(), 0);
    18. saveConfig();
    19. }else{
    20. int a = getConfig().getInt("Spieler." + p.getName());
    21. getConfig().set("Player." + p.getName(), a - amount);
    22. saveConfig();
    23. }
    24.  
    25. }
     
  5. Offline

    ahuby09

    thank you i think i can use this :p

    so how would i add point and what does Spieler do by the way sorry to bug i like to understand the code

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  6. Offline

    ThePlayerPaul

    Oh sry man i'm from Germany, normal i use the String Spieler instanceof Player sry, it means Player
     
  7. Offline

    ahuby09

    thanks
    How do i add point cause im making it so when they step over a gold block it will add a point but i dont know how to add a point
     
Thread Status:
Not open for further replies.

Share This Page