Solved How to make 'rounds' in minigames?

Discussion in 'Plugin Development' started by cluter123, Apr 9, 2016.

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

    cluter123

    I'm currently making a minigame that will require rounds 1 to let's say max 50. How would I do that in the most efficient way? I feel like making delayed schedulers for every round is inefficient.
     
  2. Offline

    ChipDev

    Well, what do you think the end of the game would be? Other than that, I think a scheduler would be the best way.
     
  3. Offline

    bennie3211

    Just use a repeating scheduler, then check every second/tick if a specific item has been taken or action is done and then go to the next round.
     
  4. Offline

    mythbusterma

    @cluter123

    Why are you so concerned with efficiency? Just do it in the way that makes the most sense and is the easiest to read.
     
  5. Offline

    cluter123

    So nesting several delayed schedules is the best way?
     
  6. Offline

    CraftCreeper6

    @cluter123
    You're saying that that's the most easy to read?
     
  7. Offline

    mythbusterma

    @cluter123

    That sounds pretty unreadable, if you ask me. Why don't you have one Runnable that represents a round, and schedule it multiple times, once for each round. That sounds more readable, doesn't it?
     
  8. Offline

    cluter123

    Yeah but the plugin does different tasks each round.
     
  9. Offline

    mcdorli

    For example?
     
  10. Offline

    cluter123

    Round one; the plugin broadcasts "hi" and gives everyone in the arena regen II
    Round two; the plugin broadcasts "bye" and gives every player resistance 5 and removes regen
    (Obviously not what my plugin does, but just an example)
     
  11. Offline

    mcdorli

    You could store information in a custom object, so you can set the effect type for a round, the message, items, etc. Then use this object and read the values, and do things according to that.
     
  12. Offline

    cluter123

    Yeah but my main point is that Bukkit doesn't wait until a runnable is finished before it moves onto the next runnable. If I we to for say do:
    RunnableObject
    Broadcast round #2
    Runnable object

    It wouldn't wait until the first runnable is done and then broadcast round number two, it would instatiate both runnable a and broadcast round #2 at the same time.

    I want the plugin to do broadcast round #1 then do something, broadcast round 2 after what I just did finished and then do another thing, etc
     
  13. Just make a int and increment it every time a round ends. Then when you increment the round, if you need to do something different in a certain round, just check the round number.
     
  14. Offline

    cluter123

    Nvm I fixed it.
     
Thread Status:
Not open for further replies.

Share This Page