Minigame Multiple Spawns

Discussion in 'Plugin Development' started by Littledaddychop, Jan 11, 2014.

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

    Littledaddychop

    Hey guys! I am making a plugin and a part of it teleports players to different spawn points, counts down from 60, and releases them. I am stuck on the countdown part and the multiple spawn part. Could anyone help me?

    xTrollxDudex
    Could you help me?
     
  2. Offline

    Superckl1

    For the random spawn points, you can put multiple locations into a List and use a random to pick a random index.

    For the countdown, you simply need to schedule a BukkitRunnable to run every 20 ticks (there are 20 ticks in a second). Have that runnable decrement an internal int and then send the player a message. It can then cancel itself when it hits 0.
     
  3. Offline

    xTrollxDudex

    Littledaddychop
    Use a List of Location's to store your spawns in the arena object. Use a runnable to do the countdown, have a static list of string player names in your move listener. Remove them when the runnable finishes.
     
  4. Offline

    Superckl1

    The list doesn't need to be static. It doesn't really matter, but you just pass a reference to it or the containing class when instantiating the runnable.
     
  5. Offline

    xTrollxDudex

    Superckl1
    It actually would be simpler to do it that way, passing an instance is a great way to keep members of the API like JavaPlugin from being instantiated more than twice, and besides that, if you made a new instance of the listener, the list would still be there. Unless of course, you are turning it into a singleton, using a final instance field (bad design by the way-thread safety) would keep it from doing anything.
     
  6. Offline

    Littledaddychop

Thread Status:
Not open for further replies.

Share This Page