Make an ore turn into stone for x seconds the turn back to ore?

Discussion in 'Plugin Development' started by bloodless2010, Sep 29, 2013.

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

    bloodless2010

    Okay; so I'm not really quite sure how to do this and I haven't done anything with block manipulation or timestamps, I'm wondering, or if someone could help me, how I could make it when someone mines an ore, it gives them the ore, the block on the map changes to stone, then after x seconds (lets say 10 for this example) it goes back to the ore it was, how would I do this? It would be good if I could set the locations of the ore in config or even in the code, thanks!!
     
  2. Offline

    tommycake50

  3. Offline

    MrSparkzz

    bloodless2010


    Going along with what tommycake50 said. (I don't know much about block manipulation in bukkit), but what you could do, is have the block change. Then set up a timer using a Scheduler. After the timer has ran through it's time, change the block back.
     
    Gater12 and tommycake50 like this.
  4. Offline

    bloodless2010

    MrSparkzz I understand the scheduler I'm just not sure how to piece this all together.

    Could someone please help me with this? Thanks

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  5. Offline

    bennie3211

    Create a hashmap that stores a location and time when it was mined, then create a scheduler that runs every 20 ticks (1 second) and check the time from the hashmap, if its the same (or smaller then the server time) you set the block back to the original state.
     
  6. Offline

    bloodless2010

    bennie3211 Like I explained before, the only thing of this I know how to do is the repeating scheduler, I would really appreciate if someone could show me how to do it :/
     
  7. Offline

    The_Doctor_123

    bloodless2010
    It's quite simple. If you have a location, you can manipulate it and get the block at that location and then manipulate the block. Look through the JavaDocs.
     
  8. Offline

    Techy4198

    don't use repeating schedulers. just get the block's material as the variable m, set the block to stone, then create a one-time scheduler inside the same class, and pass it the Block that you are changing, and the m variable, make it set the block's material to m, and tell it to run after 20 ticks
     
    tommycake50 likes this.
Thread Status:
Not open for further replies.

Share This Page