2016-04-25 20:03:39 +00:00
|
|
|
package io.github.norbipeti.thebuttonmc;
|
2015-08-19 19:30:27 +00:00
|
|
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
public class AnnouncerThread {
|
|
|
|
private static int AnnounceMessageIndex = 0;
|
|
|
|
|
|
|
|
public static void Run() {
|
|
|
|
while (!PluginMain.Instance.stop) {
|
|
|
|
try {
|
|
|
|
Thread.sleep(PluginMain.AnnounceTime);
|
|
|
|
} catch (InterruptedException ex) {
|
|
|
|
Thread.currentThread().interrupt();
|
|
|
|
}
|
2015-08-25 14:28:33 +00:00
|
|
|
if (PluginMain.AnnounceMessages.size() > AnnounceMessageIndex) {
|
|
|
|
for (Player player : PluginMain.GetPlayers())
|
|
|
|
player.sendMessage(PluginMain.AnnounceMessages
|
|
|
|
.get(AnnounceMessageIndex));
|
|
|
|
AnnounceMessageIndex++;
|
|
|
|
if (AnnounceMessageIndex == PluginMain.AnnounceMessages.size())
|
|
|
|
AnnounceMessageIndex = 0;
|
|
|
|
}
|
2015-08-19 19:30:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|