Solved Anti Bankrupt

Discussion in 'Plugin Development' started by MagmaticBacca, Nov 6, 2015.

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


    I have a Money Plugin but i recently found a problem where when i deduct a higher amount from a players balance the said balance goes negative. Ex: Bruce Wayne has $50, he buys something for something for $55, hes now bankrupt at -5 dollars. My question is how do i get an int from the config and check if the price is higher than they can afford or have in their balance?
  2. Offline



    Check if the price is greater than the amount of money the player has?

    You'd have to probably take apart the plugin to do this, you'd be better off just getting another that allows you to configure it.
  3. Offline


    Most money plugins already allow you to set whether negative balances work anyway, did you try checking your config files?
  4. Offline



    This code is not tested.
    // If the player has less than 50 in config
    if (getConfig().getInt("PLAYER.Money") < 50) {
      // Send them a message
      sender.sendMessage("Not Enough Money");
    // If the have anything above 49
    } else {
      // Send them a successful message
      sender.sendMessage("You bought something");
  5. Offline


    @boomboompower Thanks! I was going about it the wrong way but i think this method should work. Ill report back if there are any complications.
    Last edited: Nov 7, 2015
Thread Status:
Not open for further replies.

Share This Page