Block Regeneration to a RPG-Server.
Hello, I'm not very experienced in coding with skript so I would need some help with this.
When the block first is mined the code should cancel the event and replace the block with bedrock. + It should give the user the block that was mined.
It should then wait a few seconds: stone 30, coal, 1 minute, iron 2 minutes.
When the timer is up the block should get regenerated.
Please note that this should be for over 10 different blocks.
Here is what I first made:
on break coal ore:
if gamemode of player is survival:
wait 3 ticks
set event-block to bedrock
wait 60 seconds
set event-block to stone
on break stone:
if gamemode of player is survival:
wait 3 ticks
set event-block to bedrock
wait 30 seconds
set event-block to stone
However that gets really big when there's a lot of blocks, so I then thought something like this might work:
options:
Blacklist: Stone and Iron ore
lst = [("stone", 30), ("Iron Ore", 60)]
on break:
if {@Blacklist} contains event-block:
wait 3 ticks
set event-block to bedrock
wait lst[1] seconds
set event-block to lst[0]
The problem with this is that I don't know if you can assign arrays with tuples, and then do array[1] on it. If anyone knows how to solve this, or if they know an even better solution I would really appreciate it!