Custom Economy Balance Command

Discussion in 'Plugin Development' started by King_Amun_Ra, Mar 20, 2014.

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

    King_Amun_Ra

    So I'm working on a plugin that I made a makeshift economy for. I have a economy already with vault so I had to make a new one. So basically everything is working perfectly but. the balance system. Also this goes with checking for the money of the player here's my balance command


    Code:java
    1. if(cmd.getName().equalsIgnoreCase("superbal")){
    2. p.sendMessage(ChatColor.GREEN + "SuperBal: " + settings.getData().getInt(p.getName() + ".coins"));
    3. }


    Also this is my pay system but it works this is just if it helps.

    Code:java
    1. if(cmd.getName().equalsIgnoreCase("supercoingive")){
    2. if (!(p.isOp())) return true;
    3. if (args.length < 2){
    4. p.sendMessage(ChatColor.RED + "Usage: /supercoingive <player> <ammount>");
    5. return true;
    6. }
    7. Player target = Bukkit.getServer().getPlayer(args[0]);
    8.  
    9. if (target == null){
    10. p.sendMessage(ChatColor.RED + "ERROR:" + target + " not found!");
    11. return true;
    12. }if (settings.getData().getConfigurationSection(".coins") != null){
    13.  
    14. //Needs testing
    15. int coins = Integer.parseInt(args[1]);
    16. settings.getData().set(target.getName() + "." + coins, coins);
    17. settings.saveData();
    18. }else{
    19. int coins = Integer.parseInt(args[1]);
    20. settings.getData().set(target.getName() + ".coins", coins);
    21. settings.saveData();
    22. }
    23. int coins = Integer.parseInt(args[1]);
    24. p.sendMessage(ChatColor.GREEN + target.getName() + " has received " + coins + " supercoins!");
    25. target.sendMessage(ChatColor.GREEN + "You have received " + coins + " supercoin(s)!");
    26. }
     
  2. Offline

    King_Amun_Ra

    Please dose anyone know how to do this?
     
  3. Offline

    Wizehh

    What doesn't work?
     
  4. Offline

    King_Amun_Ra

    Wizehh I have to code up top but my balance command isn't working
     
  5. Offline

    MRPS

    King_Amun_Ra Are you checking that the sender is a player and casting him as such?
     
  6. Offline

    King_Amun_Ra

  7. Offline

    Wizehh

    We don't understand; what is the error? Do you have a stacktrace? What isn't working?
     
  8. Offline

    King_Amun_Ra

    Its not displaying the number
     
  9. Offline

    MOMOTHEREAL

    King_Amun_Ra Any stacktraces? Does it still show the "SuperBal :" text when launching the command? Is the plugin.yml ok? Set CommandExecutor?
     
  10. Offline

    King_Amun_Ra

  11. Offline

    King_Amun_Ra

  12. Offline

    King_Amun_Ra

    So all I need is how to get a int from a config really
     
Thread Status:
Not open for further replies.

Share This Page