Currency

Discussion in 'Plugin Development' started by jaidonpena, Sep 11, 2014.

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

    jaidonpena

    Does anyone know a way to make your own currency because i want to make all my mini games run off a currency called "Pixels" so you can earn them any use them in each game and it will also show in the lobby? I know i might need a core plugin for this but does anyone know how much that will cost... I'm clueless
     
  2. Offline

    _feedDz

    use a class like this to gain your methods to add money take money and set money
    Code:java
    1. public class Econ{
    2.  
    3. public static int bal;
    4.  
    5. public static void setBal(int amount){
    6. bal=amount;
    7. }
    8.  
    9. public static void give(int amount){
    10. int current = bal;
    11. int added = amount;
    12. int newBal = current+added;
    13. setBal(newBal);
    14. }
    15.  
    16. public static void take(int amount){
    17. int current = bal;
    18. int subtracted = amount;
    19. int newBal = current-subtracted;
    20. setBal(newBal);
    21. }
    22.  
    23. public static int getBal(){
    24. return bal;
    25. }
    26.  
    27. public static boolean isBal(int amount){
    28. if(bal >= amount){
    29. return true;
    30. }else{
    31. return false;
    32. }
    33. }
    34.  
    35. }
     
  3. Offline

    fireblast709

    jaidonpena This is not the place to ask that, for two reasons:
    • This is the subforum where people ask help with their code
    • Generally, on the fora it is not allowed to offer monetary compensation for creating plugins (if not this, then we can apply it the other way around, selling plugins is not allowed)
     
  4. Offline

    teej107

    jaidonpena To make your own currency, simply keep track of the players in a HashMap and use integers for the mapped values in the map.
     
Thread Status:
Not open for further replies.

Share This Page