Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public TS3 botApi;
- public String botID;
- public String password = getConfig().getString("MySQL.Password");
- public String database = getConfig().getString("MySQL.Database");
- public String host = getConfig().getString("MySQL.Host");
- public String port = getConfig().getString("MySQL.Port");
- public String user = getConfig().getString("MySQL.User");
- public String prefix = ChatColor.RED + "[TS3Music]";
- Boolean empty = true;
- public List<String> tracks = new ArrayList<>();
- public int size;
- db dbase = new db();
- System.out.println(ChatColor.RED + "[Music]" + ChatColor.RESET + "Plugin started!");
- List<String> botname = dbase.allName(host, port, database, user, password);
- size = botname.size();
- Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- if (!empty) {
- List<String> bots = dbase.allBots(host, port, database, user, password);
- List<String> botname = dbase.allName(host, port, database, user, password);
- if (size < botname.size()) {
- tracks.clear();
- for (@SuppressWarnings("unused") String b : botname) {
- tracks.add("");
- }
- }
- List<String> permission = dbase.perm(host, port, database, user, password);
- int i = 0;
- for (String id : bots) {
- botApi.setBotId(id);
- String[] current = botApi.currenTrack();
- String track = current[0];
- String artist = current[1];
- if (!tracks.get(i).equals(track)) {
- tracks.set(i, track);
- Bukkit.broadcast(ChatColor.RED + "Now playing on " + botname.get(i) + " the track: " + artist
- + "-" + track, "music." + permission.get(i));
- i++;
- }
- }
- }
- }
- }, 0L, 20L);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement