How would I go about doing this?

Discussion in 'Plugin Development' started by __Sour, Jan 25, 2015.

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

    __Sour

    Ok so I was wondering how I would go about doing this, say I have to points selected, with worldedit. And within those two points let say are around 500 blocks. And players will be able to mine/break the blocks (I am going for like a mine plugin). Most mine plugins are reset with timers, but I want this to reset based on the amount of blocks left in the area. So 500 blocks would be at 100% blocks left in the area. And I would like the area to refill the blocks once it gets to about 20% of blocks left inside the defined area, how would I go about doing this?
     
  2. Offline

    Skionz

    @__Sour
    I believe you would use Vector#isInAABB(Vector) to check if someone is in the area. Iterate through the blocks once in a while and count them and reset them when necessary.
     
  3. Offline

    __Sour

    @Skionz Would it be bad it iterate through the blocks every time someone breaks a block in the given area?
     
  4. Offline

    Skionz

    @__Sour Yes, it would take a long time. You could count the blocks at the beginning and when a player breaks a block you could subtract 1 from that amount.
     
    Konato_K likes this.
  5. Offline

    __Sour

    @Skionz So say when I make a mine, gets the total amount of blocks the area say 60, and saves the to a config, and the create a blocks left string, and subtract 1 from it every time a block is broken in that given area, and once it get to 20% of 60, it would reset, is that stressful? and could create lag?
     
  6. Offline

    Skionz

Thread Status:
Not open for further replies.

Share This Page