Advertisement
imBEheAR

Untitled

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