Advertisement
imBEheAR

Untitled

May 5th, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1.  
  2. import java.util.List;
  3.  
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.scheduler.BukkitRunnable;
  8.  
  9. public class AutoMSG {
  10.  
  11.     static Main plugin;
  12.     public AutoMSG(Main m) {
  13.         plugin = m;
  14.     }
  15.    
  16.     public static void start() {
  17.         new BukkitRunnable(){
  18.             int i = 0;
  19.             List<String> Messages = plugin.getConfig().getStringList("messages");
  20.             String prefix = plugin.getConfig().getString("prefix");
  21.            
  22.             public void run() {
  23.                 if(i < Messages.size()) {
  24.                     for(Player players : Bukkit.getOnlinePlayers()) {
  25.                         players.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + " " + Messages.get(i)));
  26.                     }
  27.                     i++;
  28.                 }else {
  29.                     i = 0;
  30.                 }
  31.             }
  32.         }.runTaskTimer(plugin, 20L * plugin.getConfig().getInt("time"), 20L * plugin.getConfig().getInt("time"));
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement