Any ideas?

Discussion in 'Plugin Development' started by MayoDwarf, Jun 1, 2014.

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

    MayoDwarf

    I need an idea on how to do something in my Bank plugin. I need to create a mechanism that when it's been over a week of the loans being due in the plugin then it will take the player's money and keep taking it until the loan is fully paid off. What would be the best way about going about this? Thanks. - Jared (MayoDwarf)
     
  2. Offline

    Mrawesomecookie

    MayoDwarf
    You'll want store the date in which the player made the loan, then every time they login compare the current date to the one you stored. When it has been 7 days, take the money and store that. When a player pays it, they get removed from the list of people who have had money taken, and also the list of people with debt.
     
  3. Offline

    MayoDwarf

    BUMP Any other ideas?
     
  4. Offline

    pluginsbyjason

    When a player takes out a loan, you record the loan date attached to the player as a current day of the year (example. 126/365). Each day you check to see if any [current day-loan date => 7], if it is then you remove the balance of the player and subtract that balance from the total loan and return any remainder [total loan - balance] until [total loan <= 0].
     
  5. Offline

    whitehooder

    Assuming it's a server not going down at any time you could do it by using a Bukkit repeating task repeating every week (assuming you're talking about in-game weeks the task would repeat every 168000 ticks). Store the amounts of cash and the loans each player has in a yaml config file for instance and go on from there. If it's real time weeks you'd be better off with what Mrawesomecookie said above. Possibly a little bit of both, just so that players don't have to relog to see the changes.

    Best of luck, and if you need any code samples feel free to ask.
     
Thread Status:
Not open for further replies.

Share This Page