Removing money from a players balance.

Discussion in 'Plugin Development' started by CoderRevolq, Mar 22, 2014.

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

    CoderRevolq

    So I am making a repair command where it repairs your armor but it takes your money away. I did the code but I get an internal error.

    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    2. if (cmd.getName().equalsIgnoreCase("repair")) {
    3. Player p = (Player) sender;
    4. p.sendMessage(ChatColor.GRAY + "You have repaired your armor for " + ChatColor.GOLD + SettingsManager.getInstance().getBalance(p.getName()) + " Dollars");
    5. p.getInventory().getHelmet().setDurability((short) 0);
    6. p.getInventory().getChestplate().setDurability((short) 0);
    7. p.getInventory().getLeggings().setDurability((short) 0);
    8. p.getInventory().getBoots().setDurability((short) 0);
    9. r = econ.withdrawPlayer(p.getName(), 50.0);
    10. if (r.transactionSuccess()) {
    11. p.sendMessage(ChatColor.GOLD + "50 Dollars has been subtracted from your balance!");
    12. }
    13. }
    14. return false;
    15. }
    16. }


    Someone please help me, I need help taking away money from the players balance
     
  2. Offline

    drtshock

    What's the error? Did you set up vault correctly?
     
    Mattkx4 likes this.
  3. Offline

    reider45

    You never checked if the player had enough money.
     
  4. Offline

    CoderRevolq

    How do you do that?

    Yes im pretty sure I did, it works fine with my economy commands, but this one dosnt work

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

    Mattkx4

    drtshock
    Hehe I just made you 800th like :)

    drtshock
    I just posted a thread in the Plugin Development section. I believe I placed it in the wrong place though :p If I did could you move it?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
    drtshock likes this.
Thread Status:
Not open for further replies.

Share This Page