This commit is contained in:
Color_yr committed 2023-01-08 16:03:28 +08:00
1 parent fa839a8ea6
commit 2de3d28873
18 files changed
+240 -278

No files matched your search

@@ -1,7 +1,7 @@
package coloryr.allmusic;
import coloryr.allmusic.objs.music.TopSongInfoObj;
import coloryr.allmusic.objs.music.TopLyricItemObj;
import coloryr.allmusic.music.play.TopLyricSave;
import coloryr.allmusic.music.play.PlayMusic;
import coloryr.allmusic.side.bukkit.*;
import coloryr.allmusic.side.bukkit.hooks.AllMusicPAPI;
@@ -50,7 +50,7 @@ public class AllMusicBukkit extends JavaPlugin {
if (AllMusic.getConfig().TopPAPI) {
PlayMusic.nowPlayMusic = new TopSongInfoObj();
PlayMusic.lyricItem = new TopLyricItemObj();
PlayMusic.lyric = new TopLyricSave();
pluginMessage = new PluginMessage();
getServer().getMessenger().registerOutgoingPluginChannel(this, AllMusic.channelBC);
getServer().getMessenger().registerIncomingPluginChannel(this, AllMusic.channelBC, pluginMessage);
@@ -4,8 +4,8 @@ import coloryr.allmusic.AllMusic;
import coloryr.allmusic.enums.HudPos;
import coloryr.allmusic.objs.hud.PosOBJ;
import coloryr.allmusic.objs.hud.SaveOBJ;
import coloryr.allmusic.music.play.LyricSave;
import coloryr.allmusic.objs.music.SongInfoObj;
import coloryr.allmusic.objs.music.LyricItemObj;
import coloryr.allmusic.music.play.PlayMusic;
import coloryr.allmusic.utils.Function;
import com.google.gson.Gson;
@@ -143,18 +143,17 @@ public class HudUtils {
/**
* 更新Hud的歌词数据
*
* @param showobj 显示的歌词
*/
public static void sendHudLyricData(LyricItemObj showobj) {
public static void sendHudLyricData() {
String info;
if (showobj == null) {
LyricSave obj = PlayMusic.lyric;
if (obj == null) {
info = AllMusic.getMessage().Hud.NoLyric;
} else {
String lyric = showobj.getLyric();
String tLyric = showobj.getTlyric();
String kLyric = showobj.getKly();
if (!AllMusic.getConfig().KtvMode || !showobj.isHaveK()) {
String lyric = obj.getLyric();
String tLyric = obj.getTlyric();
String kLyric = obj.getKly();
if (!AllMusic.getConfig().KtvMode) {
info = AllMusic.getMessage().Hud.Lyric
.replace("%Lyric%", lyric == null ? "" : lyric)
.replace("%Tlyric%", tLyric != null ? tLyric : "");
@@ -11,7 +11,7 @@ import coloryr.allmusic.objs.api.music.search.songs;
import coloryr.allmusic.objs.api.music.trialinfo.TrialInfoObj;
import coloryr.allmusic.objs.api.program.info.PrInfoOBJ;
import coloryr.allmusic.music.play.LyricDo;
import coloryr.allmusic.objs.music.LyricSaveObj;
import coloryr.allmusic.music.play.LyricSave;
import coloryr.allmusic.music.play.PlayMusic;
import coloryr.allmusic.objs.SearchOBJ;
import coloryr.allmusic.objs.music.SearchPageObj;
@@ -226,8 +226,8 @@ public class APIMain {
* @param id 歌曲id
* @return 结果
*/
public LyricSaveObj getLyric(String id) {
LyricSaveObj Lyric = new LyricSaveObj();
public LyricSave getLyric(String id) {
LyricSave lyric = new LyricSave();
JsonObject params = new JsonObject();
params.addProperty("id", id);
params.addProperty("cp", false);
@@ -249,10 +249,13 @@ public class APIMain {
AllMusic.log.warning("§d[AllMusic]§c歌词解析错误,正在进行第" + times + "重试");
} else {
if (temp.isHave) {
Lyric.setHaveLyric(AllMusic.getConfig().SendLyric);
Lyric.setLyric(temp.getTemp());
lyric.setHaveLyric(AllMusic.getConfig().SendLyric);
lyric.setLyric(temp.getTemp());
if (temp.isHaveK) {
lyric.setKlyric(temp.getKLyric());
}
}
return Lyric;
return lyric;
}
Thread.sleep(1000);
}
@@ -262,7 +265,7 @@ public class APIMain {
e.printStackTrace();
}
}
return Lyric;
return lyric;
}
/**
@@ -8,27 +8,18 @@ import coloryr.allmusic.utils.Function;
import java.util.*;
public class LyricDo {
private static class KL {
public char k;
public Map<Integer, Character> v;
public KL(char k, Map<Integer, Character> v) {
this.k = k;
this.v = v;
}
@Override
public String toString() {
return String.valueOf(k);
}
}
private final Map<Integer, LyricItemObj> temp = new HashMap<>();
private final Map<Integer, LyricItemObj> temp = new LinkedHashMap<>();
public boolean isHave = false;
public boolean isHaveK = false;
public Map<Integer, LyricItemObj> getTemp() {
return temp;
}
public Map<Integer, String> kly = new LinkedHashMap<>();
public Map<Integer, String> getKLyric() {
return kly;
}
/**
* 检查歌词
@@ -40,14 +31,12 @@ public class LyricDo {
String[] lyric;
boolean haveT = false;
boolean haveK = false;
if (!obj.isOk())
return true;
else if (obj.isNone())
return false;
lyric = obj.getLyric().split("\n");
List<KL> temp2 = new ArrayList<>();
Map<Integer, String> temp = getTime(Arrays.asList(lyric));
Map<Integer, String> temp1 = new HashMap<>();
@@ -59,39 +48,21 @@ public class LyricDo {
if (obj.getKlyric() != null && !obj.getKlyric().isEmpty()) {
String[] klyric = obj.getKlyric().split("\n");
char[] temp3 = new char[1];
for (String item : klyric) {
Map<Integer, Character> temp4 = getKTime(item, temp3);
Map<Integer, String> temp4 = getKTime(item);
if (temp4 != null) {
temp2.add(new KL(temp3[0], temp4));
kly.putAll(temp4);
}
}
haveK = true;
isHaveK = true;
}
int index = 0;
for (Map.Entry<Integer, String> item : temp.entrySet()) {
Map<Integer, Character> temp6 = null;
if (haveK) {
char temp7 = item.getValue().charAt(0);
if (index == temp2.size()) {
index = 0;
}
while (index < temp2.size()) {
KL temp5 = temp2.get(index);
if (temp5.k == temp7) {
temp6 = temp5.v;
index++;
break;
}
index++;
}
}
this.temp.put(item.getKey(), new LyricItemObj(item.getKey(), haveT,
item.getValue(), temp1.get(item.getKey()), temp6, temp6 != null));
this.temp.put(item.getKey(), new LyricItemObj(item.getValue(),
haveT ? temp1.get(item.getKey()): null));
}
isHave = true;
return false;
}
@@ -139,14 +110,14 @@ public class LyricDo {
}
time = Integer.parseInt(min) * 60 * 1000 + Integer.parseInt(sec) * 1000 + milt * 10;
if (time > 0 && time + AllMusic.getConfig().Delay > 0)
time += AllMusic.getConfig().Delay * 10;
time += AllMusic.getConfig().Delay / 10 * 10;
res.put(time, Function.getString(s, "]", null));
}
return res;
}
private Map<Integer, Character> getKTime(String lyric, char[] time1) {
Map<Integer, Character> res = new HashMap<>();
private Map<Integer, String> getKTime(String lyric) {
Map<Integer, String> res = new LinkedHashMap<>();
if (!lyric.startsWith("[") || !lyric.contains("]("))
return null;
@@ -154,17 +125,17 @@ public class LyricDo {
if (temp1.length == 1)
return null;
int now = 0;
String temp = Function.getString(lyric, "[", "]");
String[] temp11 = temp.split(",");
int now = Integer.parseInt(temp11[0]) / 10 * 10;
for (int a = 1; a < temp1.length; a++) {
String time = temp1[a];
int temp2 = time.indexOf(')');
String temp3 = time.substring(2, temp2);
int temp5 = Integer.parseInt(temp3) / 10 * 10;
char temp6 = time.charAt(temp2 + 1);
if (a == 1) {
time1[0] = temp6;
}
res.put(now, temp6);
int temp5 = (Integer.parseInt(temp3) / 10 * 10);
if (temp5 > 0 && temp5 + AllMusic.getConfig().KDelay > 0)
temp5 += (AllMusic.getConfig().KDelay / 10 * 10);
res.put(now, time.substring(temp2 + 1));
now += temp5;
}
@@ -0,0 +1,110 @@
package coloryr.allmusic.music.play;
import coloryr.allmusic.objs.music.LyricItemObj;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class LyricSave {
private Map<Integer, LyricItemObj> lyric;
private Map<Integer, String> klyric;
protected boolean haveLyric;
protected String lly;
protected String kly;
protected String tly;
private LyricItemObj now;
private int last;
public int lastIndex = 0;
private String kNow;
public LyricSave() {
haveLyric = false;
lyric = new HashMap<>();
}
public void setLyric(Map<Integer, LyricItemObj> lyric) {
this.lyric = lyric;
}
public void setKlyric(Map<Integer, String> klyric) {
this.klyric = klyric;
}
public boolean isHaveLyric() {
return haveLyric;
}
public void setHaveLyric(boolean haveLyric) {
this.haveLyric = haveLyric;
}
public String getLyric() {
return lly;
}
public String getTlyric() {
return tly;
}
public String getKly() {
return kly;
}
public boolean kUpdate() {
if (lastIndex >= now.lyric.length()) {
kly = now.lyric;
lly = "";
} else if (kNow != null) {
int index = now.lyric.toLowerCase(Locale.ROOT).indexOf(kNow, lastIndex);
if (index != -1) {
lastIndex = index + kNow.length();
kly = now.lyric.substring(0, lastIndex);
lly = now.lyric.substring(lastIndex);
return true;
}
} else {
kly = "";
}
return false;
}
public boolean ktv(int time) {
if (last == time || klyric == null)
return false;
String temp = klyric.get(time);
if (temp != null) {
kNow = temp.toLowerCase(Locale.ROOT);
last = time;
return kUpdate();
}
return false;
}
public boolean checkTime(int playNow, boolean ktv) {
if (lyric == null)
return false;
boolean res = false;
LyricItemObj temp = lyric.get(playNow);
if (temp != null) {
now = temp;
lly = now.lyric;
tly = now.tlyric;
kly = null;
lastIndex = 0;
kUpdate();
return true;
}
if (ktv && now != null) {
res = ktv(playNow);
}
return res;
}
}
@@ -2,11 +2,8 @@ package coloryr.allmusic.music.play;
import coloryr.allmusic.AllMusic;
import coloryr.allmusic.hud.HudUtils;
import coloryr.allmusic.objs.music.LyricItemObj;
import coloryr.allmusic.objs.music.LyricSaveObj;
import coloryr.allmusic.objs.music.MusicObj;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -83,7 +80,6 @@ public class PlayGo {
PlayMusic.musicAllTime = 0;
PlayMusic.musicLessTime = 0;
PlayMusic.lyric = null;
PlayMusic.lyricItem = null;
PlayMusic.nowPlayMusic = null;
AllMusic.side.updateInfo();
closeTimer();
@@ -101,26 +97,17 @@ public class PlayGo {
private static void time2() {
try {
LyricItemObj show = PlayMusic.lyric.checkTime(PlayMusic.musicNowTime);
if (show != null) {
PlayMusic.lyricItem = show;
boolean res = PlayMusic.lyric.checkTime(PlayMusic.musicNowTime, AllMusic.getConfig().KtvMode);
if (res) {
times = 0;
HudUtils.sendHudLyricData(show);
HudUtils.sendHudLyricData();
AllMusic.side.updateLyric();
} else {
if (PlayMusic.lyricItem != null &&
AllMusic.getConfig().KtvMode && PlayMusic.lyricItem.isHaveK()) {
if (PlayMusic.lyricItem.ktv(PlayMusic.musicNowTime)) {
HudUtils.sendHudLyricData(PlayMusic.lyricItem);
AllMusic.side.updateLyric();
}
} else {
times++;
if (times == 500 && PlayMusic.lyricItem != null) {
times = 0;
HudUtils.sendHudLyricData(PlayMusic.lyricItem);
AllMusic.side.updateLyric();
}
times++;
if (times == 500 && PlayMusic.lyric != null) {
times = 0;
HudUtils.sendHudLyricData();
AllMusic.side.updateLyric();
}
}
} catch (Exception e) {
@@ -137,7 +124,7 @@ public class PlayGo {
try {
if (PlayMusic.getSize() == 0) {
HudUtils.sendHudNowData();
HudUtils.sendHudLyricData(null);
HudUtils.sendHudLyricData();
HudUtils.sendHudListData();
if (AllMusic.side.needPlay()) {
String ID = AllMusic.getMusicApi().getListMusic();
@@ -170,7 +157,7 @@ public class PlayGo {
if (PlayMusic.nowPlayMusic.getPlayerUrl() == null)
PlayMusic.lyric = AllMusic.getMusicApi().getLyric(PlayMusic.nowPlayMusic.getID());
else
PlayMusic.lyric = new LyricSaveObj();
PlayMusic.lyric = new LyricSave();
if (PlayMusic.nowPlayMusic.getLength() != 0) {
PlayMusic.musicAllTime = PlayMusic.musicLessTime = (PlayMusic.nowPlayMusic.getLength() / 1000) + 3;
@@ -4,8 +4,6 @@ import coloryr.allmusic.AllMusic;
import coloryr.allmusic.decoder.Bitstream;
import coloryr.allmusic.decoder.Header;
import coloryr.allmusic.objs.music.SongInfoObj;
import coloryr.allmusic.objs.music.LyricItemObj;
import coloryr.allmusic.objs.music.LyricSaveObj;
import coloryr.allmusic.objs.music.MusicObj;
import coloryr.allmusic.utils.Logs;
@@ -48,11 +46,7 @@ public class PlayMusic {
/**
* 当前歌词信息
*/
public static LyricSaveObj lyric;
/**
* 当前歌词
*/
public static LyricItemObj lyricItem;
public static LyricSave lyric;
/**
* 错误次数
*/
@@ -0,0 +1,28 @@
package coloryr.allmusic.music.play;
public class TopLyricSave extends LyricSave {
public void setTlyric(String data) {
tly = data;
}
public void setLyric(String data) {
lly = data;
}
public void setKly(String data) {
kly = data;
}
public void setHaveK(boolean data) {
if (!data) {
kly = null;
}
}
public void setHaveT(boolean data) {
if (!data) {
tly = null;
}
}
}
@@ -43,6 +43,10 @@ public class ConfigOBJ {
* 最长音乐长度
*/
public int MaxMusicTime;
/**
* KTV模式歌词加时
*/
public int KDelay;
/**
* 管理员ID列表
@@ -170,6 +174,7 @@ public class ConfigOBJ {
Economy = new EconomyObj();
KtvMode = true;
KDelay = 0;
Version = AllMusic.version;
}
@@ -5,87 +5,24 @@ import coloryr.allmusic.AllMusic;
import java.util.Map;
public class LyricItemObj {
protected boolean haveT;
protected boolean haveK;
protected String lyric;
protected String tlyric;
protected Map<Integer, Character> klyric;
protected int start;
protected int last;
protected String kly;
protected String lly;
protected int lastIndex = 0;
public String lyric;
public String tlyric;
public LyricItemObj(int start, boolean haveT, String lyric, String tlyric,
Map<Integer, Character> klyric, boolean haveK) {
this.start = start;
this.haveT = haveT;
public LyricItemObj(String lyric, String tlyric) {
this.lyric = lyric;
this.tlyric = tlyric;
this.klyric = klyric;
this.haveK = haveK;
this.lly = lyric;
if (haveK) {
kly = "";
}
}
public boolean ktv(int time) {
if (last == time || klyric == null)
return false;
Character temp = klyric.get(time - start);
if (temp != null) {
if (lastIndex >= lyric.length()) {
kly = lyric;
lly = "";
} else {
int index = lyric.indexOf(temp, lastIndex);
if (index == lyric.length() - 1) {
kly = lyric;
lly = "";
lastIndex = lyric.length();
} else if (index != -1) {
lastIndex = index + 1;
kly = lyric.substring(0, index + 1);
lly = lyric.substring(index + 1);
}
}
last = time;
return true;
}
return false;
}
public String getKly() {
return kly;
}
public boolean isHaveK() {
return haveK;
}
public String getTlyric() {
return tlyric;
}
public String getLyric() {
return lly;
}
public String getString() {
if (lyric == null || lyric.isEmpty())
return "";
String data;
if (haveT) {
if (tlyric != null && !tlyric.isEmpty()) {
data = AllMusic.getMessage().Lyric.TData;
return data.replace("%Lyric%", lyric)
.replace("%TLyric%", tlyric);
}
if (tlyric != null && !tlyric.isEmpty()) {
data = AllMusic.getMessage().Lyric.TData;
return data.replace("%Lyric%", lyric)
.replace("%TLyric%", tlyric);
}
data = AllMusic.getMessage().Lyric.Data;
return data.replace("%Lyric%", lyric);
}
@@ -1,36 +0,0 @@
package coloryr.allmusic.objs.music;
import coloryr.allmusic.objs.music.LyricItemObj;
import java.util.HashMap;
import java.util.Map;
public class LyricSaveObj {
private Map<Integer, LyricItemObj> lyric;
private boolean haveLyric;
public LyricSaveObj() {
haveLyric = false;
lyric = new HashMap<>();
}
public void setLyric(Map<Integer, LyricItemObj> lyric) {
this.lyric = lyric;
}
public boolean isHaveLyric() {
return haveLyric;
}
public void setHaveLyric(boolean haveLyric) {
this.haveLyric = haveLyric;
}
public LyricItemObj checkTime(int playNow) {
if (lyric == null)
return null;
if (lyric.containsKey(playNow))
return lyric.get(playNow);
return null;
}
}
@@ -1,35 +0,0 @@
package coloryr.allmusic.objs.music;
import coloryr.allmusic.objs.music.LyricItemObj;
public class TopLyricItemObj extends LyricItemObj {
public TopLyricItemObj() {
super(0, false, null, null, null, false);
}
public void setTlyric(String data) {
tlyric = data;
}
public void setLyric(String data) {
lyric = data;
}
public void setKly(String data) {
kly = data;
}
public void setHaveK(boolean data) {
haveK = data;
if (!haveK) {
kly = null;
}
}
public void setHaveT(boolean data) {
haveT = data;
if (!haveT) {
tlyric = null;
}
}
}
@@ -340,36 +340,36 @@ public class SideBC implements ISide {
public static void sendLyricToServer(Server server) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeInt(7);
if (PlayMusic.lyricItem == null)
if (PlayMusic.lyric == null)
out.writeUTF("");
else
out.writeUTF(PlayMusic.lyricItem.getLyric());
out.writeUTF(PlayMusic.lyric.getLyric());
server.sendData(AllMusic.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(8);
if (PlayMusic.lyricItem == null || PlayMusic.lyricItem.getTlyric() == null)
if (PlayMusic.lyric == null || PlayMusic.lyric.getTlyric() == null)
out.writeUTF("");
else
out.writeUTF(PlayMusic.lyricItem.getTlyric());
out.writeUTF(PlayMusic.lyric.getTlyric());
server.sendData(AllMusic.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(9);
out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getTlyric() != null);
out.writeBoolean(PlayMusic.lyric != null && PlayMusic.lyric.getTlyric() != null);
server.sendData(AllMusic.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(10);
if (PlayMusic.lyricItem == null || PlayMusic.lyricItem.getKly() == null)
if (PlayMusic.lyric == null || PlayMusic.lyric.getKly() == null)
out.writeUTF("");
else
out.writeUTF(PlayMusic.lyricItem.getTlyric());
out.writeUTF(PlayMusic.lyric.getTlyric());
server.sendData(AllMusic.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(11);
out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getKly() != null);
out.writeBoolean(PlayMusic.lyric != null && PlayMusic.lyric.getKly() != null);
server.sendData(AllMusic.channelBC, out.toByteArray());
}
@@ -3,7 +3,7 @@ package coloryr.allmusic.side.bukkit;
import coloryr.allmusic.AllMusic;
import coloryr.allmusic.AllMusicBukkit;
import coloryr.allmusic.objs.music.TopSongInfoObj;
import coloryr.allmusic.objs.music.TopLyricItemObj;
import coloryr.allmusic.music.play.TopLyricSave;
import coloryr.allmusic.music.play.PlayMusic;
import com.google.common.collect.Iterables;
import com.google.common.io.ByteArrayDataInput;
@@ -25,11 +25,11 @@ public class PluginMessage implements PluginMessageListener {
public static String allList;
public static boolean update = false;
private final TopSongInfoObj info;
private final TopLyricItemObj lyric;
private final TopLyricSave lyric;
public PluginMessage() {
info = (TopSongInfoObj) PlayMusic.nowPlayMusic;
lyric = (TopLyricItemObj) PlayMusic.lyricItem;
lyric = (TopLyricSave) PlayMusic.lyric;
service = Executors.newSingleThreadScheduledExecutor();
service.scheduleAtFixedRate(PluginMessage::clear, 0, 30, TimeUnit.SECONDS);
@@ -86,13 +86,13 @@ public class AllMusicPAPI extends PlaceholderExpansion {
return PluginMessage.allList;
}
case "lyric": {
return PlayMusic.lyricItem.getLyric();
return PlayMusic.lyric.getLyric();
}
case "tlyric": {
return PlayMusic.lyricItem.getTlyric();
return PlayMusic.lyric.getTlyric();
}
case "klyric": {
return PlayMusic.lyricItem.getKly();
return PlayMusic.lyric.getKly();
}
}
} else {
@@ -134,19 +134,19 @@ public class AllMusicPAPI extends PlaceholderExpansion {
return PlayMusic.getAllList();
}
case "lyric": {
if (PlayMusic.lyricItem == null)
if (PlayMusic.lyric == null)
return "";
return PlayMusic.lyricItem.getLyric();
return PlayMusic.lyric.getLyric();
}
case "tlyric": {
if (PlayMusic.lyricItem == null)
if (PlayMusic.lyric == null)
return "";
return PlayMusic.lyricItem.getTlyric();
return PlayMusic.lyric.getTlyric();
}
case "klyric": {
if (PlayMusic.lyricItem == null)
if (PlayMusic.lyric == null)
return "";
return PlayMusic.lyricItem.getKly();
return PlayMusic.lyric.getKly();
}
}
}
@@ -343,36 +343,36 @@ public class SideVelocity implements ISide {
public static void sendLyricToServer(ServerConnection server) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeInt(7);
if (PlayMusic.lyricItem == null)
if (PlayMusic.lyric == null)
out.writeUTF("");
else
out.writeUTF(PlayMusic.lyricItem.getLyric());
out.writeUTF(PlayMusic.lyric.getLyric());
server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(8);
if (PlayMusic.lyricItem == null || PlayMusic.lyricItem.getTlyric() == null)
if (PlayMusic.lyric == null || PlayMusic.lyric.getTlyric() == null)
out.writeUTF("");
else
out.writeUTF(PlayMusic.lyricItem.getTlyric());
out.writeUTF(PlayMusic.lyric.getTlyric());
server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(9);
out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getTlyric() != null);
out.writeBoolean(PlayMusic.lyric != null && PlayMusic.lyric.getTlyric() != null);
server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(10);
if (PlayMusic.lyricItem == null || PlayMusic.lyricItem.getKly() == null)
if (PlayMusic.lyric == null || PlayMusic.lyric.getKly() == null)
out.writeUTF("");
else
out.writeUTF(PlayMusic.lyricItem.getTlyric());
out.writeUTF(PlayMusic.lyric.getTlyric());
server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());
out = ByteStreams.newDataOutput();
out.writeInt(11);
out.writeBoolean(PlayMusic.lyricItem != null && PlayMusic.lyricItem.getKly() != null);
out.writeBoolean(PlayMusic.lyric != null && PlayMusic.lyric.getKly() != null);
server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());
}
+1
View File
@@ -2,6 +2,7 @@
"MaxList": 10,
"MinVote": 3,
"Delay": 0,
"KDelay": 600,
"Admin": ["CONSOLE","Color_yr"],
"LoginUser": "",
"NoMusicServer": [],
+6 -8
View File
@@ -1,11 +1,9 @@
import coloryr.allmusic.AllMusic;
import coloryr.allmusic.objs.CookieObj;
import coloryr.allmusic.objs.music.LyricItemObj;
import coloryr.allmusic.objs.music.LyricSaveObj;
import coloryr.allmusic.music.play.LyricSave;
import coloryr.allmusic.side.IMyLogger;
import java.util.Map;
public class RunTest implements IMyLogger {
public static void main(String[] arg) {
AllMusic.cookie = new CookieObj();
@@ -15,15 +13,15 @@ public class RunTest implements IMyLogger {
// {
//
// }
LyricSaveObj obj = AllMusic.getMusicApi().getLyric("28151022");
LyricSave obj = AllMusic.getMusicApi().getLyric("28151022");
if (obj.isHaveLyric()) {
LyricItemObj item = obj.checkTime(15970);
int time = 0;
while (true) {
boolean res = item.ktv(time);
boolean res = obj.checkTime(time, true);
if (res) {
String temp = item.getKly();
System.out.println(temp);
String temp = obj.getKly();
if (temp != null)
System.out.println(temp);
}
time += 10;
}