Advertisement
Guest User

Untitled

a guest
Jun 18th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.15 KB | None | 0 0
  1.     public TS3 botApi;
  2.     public String botID;
  3.     public String password = getConfig().getString("MySQL.Password");
  4.     public String database = getConfig().getString("MySQL.Database");
  5.     public String host = getConfig().getString("MySQL.Host");
  6.     public String port = getConfig().getString("MySQL.Port");
  7.     public String user = getConfig().getString("MySQL.User");
  8.     public String prefix = ChatColor.RED + "[TS3Music]";
  9.     Boolean empty = true;
  10.     public List<String> tracks = new ArrayList<>();
  11.     public int size;
  12.  
  13.  
  14.  
  15.  
  16.         db dbase = new db();
  17.         System.out.println(ChatColor.RED + "[Music]" + ChatColor.RESET + "Plugin started!");
  18.         List<String> botname = dbase.allName(host, port, database, user, password);
  19.         size = botname.size();
  20.         Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
  21.  
  22.             @Override
  23.             public void run() {
  24.                 if (!empty) {
  25.                     List<String> bots = dbase.allBots(host, port, database, user, password);
  26.                     List<String> botname = dbase.allName(host, port, database, user, password);
  27.                     if (size < botname.size()) {
  28.                         tracks.clear();
  29.                         for (@SuppressWarnings("unused") String b : botname) {
  30.                             tracks.add("");
  31.                         }
  32.                     }
  33.                     List<String> permission = dbase.perm(host, port, database, user, password);
  34.                     int i = 0;
  35.                     for (String id : bots) {
  36.                         botApi.setBotId(id);
  37.                         String[] current = botApi.currenTrack();
  38.                         String track = current[0];
  39.                         String artist = current[1];
  40.                         if (!tracks.get(i).equals(track)) {
  41.                             tracks.set(i, track);
  42.                             Bukkit.broadcast(ChatColor.RED + "Now playing on " + botname.get(i) + " the track: " + artist
  43.                                     + "-" + track, "music." + permission.get(i));
  44.                             i++;
  45.                         }
  46.                     }
  47.  
  48.                 }
  49.             }
  50.  
  51.         }, 0L, 20L);
  52.  
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement