Solved Money Printers

Discussion in 'Plugin Development' started by sniddunc, Dec 20, 2015.

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

    sniddunc

    Hello all.

    I am wondering whether or not anyone could explain to me how I could accomplish this:

    - Player places a printer block
    - Once the money printer is created, every second or so it should generate $1 or some other amount
    - When the play right clicks the block it collects the money

    The part that I really don't know how to do is the storing of data for a block. Players will have to be able to steal them, so it would also have to keep track of how many printers a player has. Would I use a list, a hashmap or something else for both these things? I was thinking about using data files but this seemed like a bad idea for something that would be updated so frequently.

    I'm not looking for someone to do this for me, I'd just like some advice on what I would have to do to accomplish this.

    Thank you for any advice given. :)
     
  2. Offline

    Nibbit

    Hashmaps...
    And probably make a list of all the players in the server with their money printer locations stored with it in the config like :
    player:
    printers:
    printer1:
    x:
    y:
    z:


    :p
     
  3. Offline

    Lightspeed

    What do you mean by printer block? A modded block or a normal block like a diamond block or custom player head?
     
  4. Offline

    sniddunc

    Thank you, I should be able to work with that suggestion.

    Yes, I mean like a diamond block (a custom player head is a good idea that didn't occur to me though).

    So the player places a diamond block (or another printer block), it's location gets saved and it starts printing money (which I'm not 100% sure how to do yet).


    Could someone recommend a method to track each individual printer balance?
     
    Last edited: Dec 20, 2015
  5. Offline

    Lightspeed

    You can start a bukkit runnabe repeating until the block no longer exists giving a player somthing.
     
  6. Offline

    Nibbit

    Hashmaps :D
    Just make a hashmap with the block and with the money next to it like :
    Code:
        HashMap<Location, Integer> moneymap = new HashMap<Location, Integer>();
    Btw. The location is the location of the block so you can get the block at that location :p I don't think blocks can be saved in a hashmap. This seems to work for me!

    And as @Lightspeed said you can just make a bukkit runnable that adds 1 every second
     
  7. Offline

    sniddunc

    Thank you both for the help, It appears to be working properly. :)
     
    Nibbit likes this.
  8. Offline

    Lightspeed

  9. Offline

    Nibbit

    Np :D
     
Thread Status:
Not open for further replies.

Share This Page