Creating rank prices

Discussion in 'Plugin Development' started by glasseater, Jun 17, 2016.

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

    glasseater

    Hey guys,

    I've been making a rank shop plugin ingame to comply with the EULA. My only question is how do I make custom prices for the ranks?

    So I have this method but it always removes 50000.

    Code:
      public static void buyRank(String name) {
        int money = 0;
        if (c.isSet(name + ".coins")) {
          coins = c.getInt(name + ".coins");
        }
        c.set(name + ".coins", Integer.valueOf(coins - 50000));
        save();
      }
    Now how would could I create it so that it gets the price from the config which looks like this

    Code:
    FARMER: (PRICE HERE)
    HUNTER: (PRICE HERE)
    KNIGHT: (PRICE HERE)
    WIZARD: (PRICE HERE)
    OVERLORD: (PRICE HERE)
    And that would go in the current config
     
  2. Offline

    Zombie_Striker

    @glasseater
    c.set(name + ".coins", Integer.valueOf(coins - 50000));

    I'm assuming the price is the 50000. In that case:
    1. Create a "price" variable. It will be equal to the price of the rank.
    2. set the config value to coins - price.
    You should also make sure the amount of coins the player has is greater than the price of the rank.
     
Thread Status:
Not open for further replies.

Share This Page