Advertisement
imBEheAR

auto-msg

Oct 13th, 2021
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. //CONFIG
  2. automsg:
  3.   time: 50
  4.   prefix: '&2[&l!&2] '
  5.   messages:
  6.     - '&7Wiadomosc testowa &a#1'
  7.     - '&7Wiadomosc testowa &a#2'
  8.     - '&7Wiadomosc testowa &a#3'
  9.     - '&7Wiadomosc testowa &a#4'
  10.     - '&7Wiadomosc testowa &a#5'
  11.  
  12.  
  13. //AUTOMSG-CLASS
  14.  
  15.     public AutoMsg(CorePlugin msg) {
  16.         plugin = msg;
  17.     }
  18.  
  19.     public static void start() {
  20.         (new BukkitRunnable() {
  21.             int i = 0;
  22.  
  23.             List<String> Messages = AutoMsg.plugin.getConfig().getStringList("automsg.messages");
  24.  
  25.             String prefix = AutoMsg.plugin.getConfig().getString("automsg.prefix");
  26.  
  27.             public void run() {
  28.                 if (this.i < this.Messages.size()) {
  29.                     Bukkit.broadcastMessage(ChatUtil.fixColor(this.prefix + (String)this.Messages.get(this.i)));
  30.                     this.i++;
  31.                 } else {
  32.                     this.i = 0;
  33.                 }
  34.             }
  35.         }).runTaskTimer((Plugin)plugin, 20L * plugin.getConfig().getInt("automsg.time"), 20L * plugin.getConfig().getInt("automsg.time"));
  36.     }
  37. }
  38.  
  39. //REGISTER W ONENABLE
  40.         new AutoMsg(this);
  41.         AutoMsg.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement