mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-22 10:49:42 +00:00
up
This commit is contained in:
1 parent
6d0a270f6b
commit
82aef4c018
71 files changed
+352
-347
No files matched your search
@@ -1,15 +1,16 @@
|
||||
package coloryr.allmusic;
|
||||
|
||||
import coloryr.allmusic.hud.DataSql;
|
||||
import coloryr.allmusic.hud.HudSave;
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
import coloryr.allmusic.message.MessageOBJ;
|
||||
import coloryr.allmusic.hud.HudUtils;
|
||||
import coloryr.allmusic.objs.hud.SaveOBJ;
|
||||
import coloryr.allmusic.objs.MessageOBJ;
|
||||
import coloryr.allmusic.music.api.APIMain;
|
||||
import coloryr.allmusic.music.api.http.CookieObj;
|
||||
import coloryr.allmusic.objs.CookieObj;
|
||||
import coloryr.allmusic.music.play.MusicSearch;
|
||||
import coloryr.allmusic.music.play.PlayGo;
|
||||
import coloryr.allmusic.music.play.PlayMusic;
|
||||
import coloryr.allmusic.music.search.SearchPage;
|
||||
import coloryr.allmusic.objs.music.SearchPageObj;
|
||||
import coloryr.allmusic.objs.ConfigOBJ;
|
||||
import coloryr.allmusic.side.ComType;
|
||||
import coloryr.allmusic.side.IMyLogger;
|
||||
import coloryr.allmusic.side.ISide;
|
||||
@@ -52,7 +53,7 @@ public class AllMusic {
|
||||
* 搜歌结果
|
||||
* 玩家名 结果
|
||||
*/
|
||||
private static final Map<String, SearchPage> searchSave = new HashMap<>();
|
||||
private static final Map<String, SearchPageObj> searchSave = new HashMap<>();
|
||||
/**
|
||||
* 投票的玩家
|
||||
*/
|
||||
@@ -177,7 +178,7 @@ public class AllMusic {
|
||||
* @param player 用户名
|
||||
* @param page 结果
|
||||
*/
|
||||
public static void addSearch(String player, SearchPage page) {
|
||||
public static void addSearch(String player, SearchPageObj page) {
|
||||
searchSave.put(player, page);
|
||||
}
|
||||
|
||||
@@ -186,7 +187,7 @@ public class AllMusic {
|
||||
* @param player 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
public static SearchPage getSearch(String player) {
|
||||
public static SearchPageObj getSearch(String player) {
|
||||
return searchSave.get(player);
|
||||
}
|
||||
|
||||
@@ -388,7 +389,7 @@ public class AllMusic {
|
||||
|
||||
AllMusic.side.runTask(() -> {
|
||||
if (PlayMusic.nowPlayMusic != null) {
|
||||
SaveOBJ obj = HudSave.get(player);
|
||||
SaveOBJ obj = HudUtils.get(player);
|
||||
String data = gson.toJson(obj);
|
||||
AllMusic.side.send(data, player, null);
|
||||
AllMusic.side.send(ComType.play + PlayGo.url, player, true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package coloryr.allmusic;
|
||||
|
||||
import coloryr.allmusic.hud.obj.HudPos;
|
||||
import coloryr.allmusic.enums.HudPos;
|
||||
import coloryr.allmusic.side.ComType;
|
||||
|
||||
public class AllMusicAPI {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package coloryr.allmusic;
|
||||
|
||||
import coloryr.allmusic.music.api.TopSongInfo;
|
||||
import coloryr.allmusic.music.lyric.TopLyricItem;
|
||||
import coloryr.allmusic.objs.music.TopSongInfoObj;
|
||||
import coloryr.allmusic.objs.music.TopLyricItemObj;
|
||||
import coloryr.allmusic.music.play.PlayMusic;
|
||||
import coloryr.allmusic.side.bukkit.*;
|
||||
import coloryr.allmusic.side.bukkit.hooks.AllMusicPAPI;
|
||||
@@ -49,15 +49,15 @@ public class AllMusicBukkit extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (AllMusic.getConfig().TopPAPI) {
|
||||
PlayMusic.nowPlayMusic = new TopSongInfo();
|
||||
PlayMusic.lyricItem = new TopLyricItem();
|
||||
PlayMusic.nowPlayMusic = new TopSongInfoObj();
|
||||
PlayMusic.lyricItem = new TopLyricItemObj();
|
||||
pluginMessage = new PluginMessage();
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, AllMusic.channelBC);
|
||||
getServer().getMessenger().registerIncomingPluginChannel(this, AllMusic.channelBC, pluginMessage);
|
||||
AllMusic.log.info("§2设置为顶层模式");
|
||||
} else {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") != null
|
||||
&& AllMusic.getConfig().Economys.Vault) {
|
||||
&& AllMusic.getConfig().Economy.Vault) {
|
||||
try {
|
||||
VaultHook vault = new VaultHook();
|
||||
AllMusic.economy = vault;
|
||||
|
||||
@@ -2,12 +2,12 @@ package coloryr.allmusic.command;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.hud.HudUtils;
|
||||
import coloryr.allmusic.hud.obj.PosOBJ;
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.objs.hud.PosOBJ;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import coloryr.allmusic.music.play.MusicSearch;
|
||||
import coloryr.allmusic.music.play.PlayMusic;
|
||||
import coloryr.allmusic.music.search.SearchOBJ;
|
||||
import coloryr.allmusic.music.search.SearchPage;
|
||||
import coloryr.allmusic.objs.SearchOBJ;
|
||||
import coloryr.allmusic.objs.music.SearchPageObj;
|
||||
import coloryr.allmusic.utils.Function;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -133,7 +133,7 @@ public class CommandEX {
|
||||
* @param sender 发送者
|
||||
* @param search 搜歌结果
|
||||
*/
|
||||
public static void showSearch(Object sender, SearchPage search) {
|
||||
public static void showSearch(Object sender, SearchPageObj search) {
|
||||
int index = search.getIndex();
|
||||
SearchOBJ item;
|
||||
String info;
|
||||
@@ -294,7 +294,7 @@ public class CommandEX {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoPer);
|
||||
return;
|
||||
}
|
||||
SearchPage obj = AllMusic.getSearch(name);
|
||||
SearchPageObj obj = AllMusic.getSearch(name);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoSearch);
|
||||
} else if (!args[1].isEmpty() && Function.isInteger(args[1])) {
|
||||
@@ -319,7 +319,7 @@ public class CommandEX {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoPer);
|
||||
return;
|
||||
}
|
||||
SearchPage obj = AllMusic.getSearch(name);
|
||||
SearchPageObj obj = AllMusic.getSearch(name);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoSearch);
|
||||
} else if (obj.nextPage()) {
|
||||
@@ -334,7 +334,7 @@ public class CommandEX {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoPer);
|
||||
return;
|
||||
}
|
||||
SearchPage obj = AllMusic.getSearch(name);
|
||||
SearchPageObj obj = AllMusic.getSearch(name);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoSearch);
|
||||
} else if (obj.lastPage()) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.http;
|
||||
package coloryr.allmusic.enums;
|
||||
|
||||
public enum EncryptType {
|
||||
WEAPI, EAPI, API
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.hud.obj;
|
||||
package coloryr.allmusic.enums;
|
||||
|
||||
public enum HudPos {
|
||||
info, list, lyric, pic
|
||||
@@ -1,8 +1,8 @@
|
||||
package coloryr.allmusic.hud;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.hud.obj.PosOBJ;
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
import coloryr.allmusic.objs.hud.PosOBJ;
|
||||
import coloryr.allmusic.objs.hud.SaveOBJ;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
@@ -190,7 +190,7 @@ public class DataSql {
|
||||
obj.Pic = pos4;
|
||||
obj.EnablePic = set.getInt(13) == 1;
|
||||
obj.PicSize = set.getInt(14);
|
||||
HudSave.add(name, obj);
|
||||
HudUtils.add(name, obj);
|
||||
}
|
||||
stat.close();
|
||||
} catch (Exception e) {
|
||||
@@ -220,7 +220,7 @@ public class DataSql {
|
||||
public static void stop() {
|
||||
isRun = false;
|
||||
semaphore.release();
|
||||
HudSave.save();
|
||||
HudUtils.save();
|
||||
}
|
||||
|
||||
private static void run() {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package coloryr.allmusic.hud;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class HudSave {
|
||||
private static final Map<String, SaveOBJ> huds = new ConcurrentHashMap<>();
|
||||
|
||||
public static SaveOBJ get(String name) {
|
||||
if (!huds.containsKey(name)) {
|
||||
SaveOBJ obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
huds.put(name, obj);
|
||||
DataSql.task(() -> DataSql.addUser(name, obj));
|
||||
return obj;
|
||||
}
|
||||
return huds.get(name);
|
||||
}
|
||||
|
||||
public static void add(String name, SaveOBJ hud) {
|
||||
huds.put(name, hud);
|
||||
}
|
||||
|
||||
public static void addAndSave(String name, SaveOBJ hud) {
|
||||
huds.put(name, hud);
|
||||
DataSql.task(() -> DataSql.addUser(name, hud));
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
for (Map.Entry<String, SaveOBJ> item : huds.entrySet()) {
|
||||
DataSql.addUser(item.getKey(), item.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,46 @@
|
||||
package coloryr.allmusic.hud;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.hud.obj.HudPos;
|
||||
import coloryr.allmusic.hud.obj.PosOBJ;
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.music.lyric.LyricItem;
|
||||
import coloryr.allmusic.enums.HudPos;
|
||||
import coloryr.allmusic.objs.hud.PosOBJ;
|
||||
import coloryr.allmusic.objs.hud.SaveOBJ;
|
||||
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;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class HudUtils {
|
||||
private static final Map<String, SaveOBJ> huds = new ConcurrentHashMap<>();
|
||||
|
||||
public static SaveOBJ get(String name) {
|
||||
if (!huds.containsKey(name)) {
|
||||
SaveOBJ obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
huds.put(name, obj);
|
||||
DataSql.task(() -> DataSql.addUser(name, obj));
|
||||
return obj;
|
||||
}
|
||||
return huds.get(name);
|
||||
}
|
||||
|
||||
public static void add(String name, SaveOBJ hud) {
|
||||
huds.put(name, hud);
|
||||
}
|
||||
|
||||
public static void addAndSave(String name, SaveOBJ hud) {
|
||||
huds.put(name, hud);
|
||||
DataSql.task(() -> DataSql.addUser(name, hud));
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
for (Map.Entry<String, SaveOBJ> item : huds.entrySet()) {
|
||||
DataSql.addUser(item.getKey(), item.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置玩家Hud位置
|
||||
* @param player 用户名
|
||||
@@ -20,7 +50,7 @@ public class HudUtils {
|
||||
* @return 位置数据
|
||||
*/
|
||||
public static PosOBJ setHudPos(String player, String pos, String x, String y) {
|
||||
SaveOBJ obj = HudSave.get(player);
|
||||
SaveOBJ obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
HudPos pos1 = HudPos.valueOf(pos);
|
||||
@@ -46,7 +76,7 @@ public class HudUtils {
|
||||
posOBJ.x = x1;
|
||||
posOBJ.y = y1;
|
||||
|
||||
HudSave.addAndSave(player, obj);
|
||||
addAndSave(player, obj);
|
||||
AllMusic.save();
|
||||
HudUtils.sendHudPos(player);
|
||||
return posOBJ;
|
||||
@@ -62,7 +92,7 @@ public class HudUtils {
|
||||
} else {
|
||||
String now;
|
||||
StringBuilder list = new StringBuilder();
|
||||
for (SongInfo info1 : PlayMusic.getList()) {
|
||||
for (SongInfoObj info1 : PlayMusic.getList()) {
|
||||
if (info1 == null)
|
||||
continue;
|
||||
now = info1.getInfo();
|
||||
@@ -116,7 +146,7 @@ public class HudUtils {
|
||||
*
|
||||
* @param showobj 显示的歌词
|
||||
*/
|
||||
public static void sendHudLyricData(LyricItem showobj) {
|
||||
public static void sendHudLyricData(LyricItemObj showobj) {
|
||||
String info;
|
||||
if (showobj == null) {
|
||||
info = AllMusic.getMessage().Hud.NoLyric;
|
||||
@@ -138,7 +168,7 @@ public class HudUtils {
|
||||
* @return 设置结果
|
||||
*/
|
||||
public static boolean setHudEnable(String player, String pos) {
|
||||
SaveOBJ obj = HudSave.get(player);
|
||||
SaveOBJ obj = get(player);
|
||||
boolean res = false;
|
||||
if (obj == null) {
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
@@ -176,7 +206,7 @@ public class HudUtils {
|
||||
}
|
||||
}
|
||||
clearHud(player);
|
||||
HudSave.addAndSave(player, obj);
|
||||
addAndSave(player, obj);
|
||||
AllMusic.save();
|
||||
HudUtils.sendHudPos(player);
|
||||
if (pos == null) {
|
||||
@@ -221,10 +251,10 @@ public class HudUtils {
|
||||
public static void sendHudPos(String player) {
|
||||
AllMusic.side.runTask(() -> {
|
||||
try {
|
||||
SaveOBJ obj = HudSave.get(player);
|
||||
SaveOBJ obj = get(player);
|
||||
if (obj == null) {
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
HudSave.addAndSave(player, obj);
|
||||
addAndSave(player, obj);
|
||||
AllMusic.save();
|
||||
}
|
||||
String data = new Gson().toJson(obj);
|
||||
@@ -244,7 +274,7 @@ public class HudUtils {
|
||||
public static void reset(String player) {
|
||||
SaveOBJ obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
clearHud(player);
|
||||
HudSave.addAndSave(player, obj);
|
||||
addAndSave(player, obj);
|
||||
AllMusic.save();
|
||||
HudUtils.sendHudPos(player);
|
||||
}
|
||||
@@ -257,7 +287,7 @@ public class HudUtils {
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean setPicSize(String player, String size) {
|
||||
SaveOBJ obj = HudSave.get(player);
|
||||
SaveOBJ obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
if (!Function.isInteger(size))
|
||||
@@ -265,7 +295,7 @@ public class HudUtils {
|
||||
|
||||
obj.PicSize = Integer.parseInt(size);
|
||||
|
||||
HudSave.addAndSave(player, obj);
|
||||
addAndSave(player, obj);
|
||||
AllMusic.save();
|
||||
HudUtils.sendHudPos(player);
|
||||
return true;
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
package coloryr.allmusic.music.api;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.music.api.http.EncryptType;
|
||||
import coloryr.allmusic.music.api.http.HttpClientUtil;
|
||||
import coloryr.allmusic.music.api.http.HttpRes;
|
||||
import coloryr.allmusic.music.api.obj.music.info.InfoOBJ;
|
||||
import coloryr.allmusic.music.api.obj.music.list.DataOBJ;
|
||||
import coloryr.allmusic.music.api.obj.music.lyric.WLyricOBJ;
|
||||
import coloryr.allmusic.music.api.obj.music.search.SearchDataOBJ;
|
||||
import coloryr.allmusic.music.api.obj.music.search.songs;
|
||||
import coloryr.allmusic.music.api.obj.music.trialinfo.TrialInfoObj;
|
||||
import coloryr.allmusic.music.api.obj.program.info.PrInfoOBJ;
|
||||
import coloryr.allmusic.music.lyric.LyricDo;
|
||||
import coloryr.allmusic.music.lyric.LyricSave;
|
||||
import coloryr.allmusic.enums.EncryptType;
|
||||
import coloryr.allmusic.objs.HttpResObj;
|
||||
import coloryr.allmusic.objs.api.music.info.InfoOBJ;
|
||||
import coloryr.allmusic.objs.api.music.list.DataOBJ;
|
||||
import coloryr.allmusic.objs.api.music.lyric.WLyricOBJ;
|
||||
import coloryr.allmusic.objs.api.music.search.SearchDataOBJ;
|
||||
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.PlayMusic;
|
||||
import coloryr.allmusic.music.search.SearchOBJ;
|
||||
import coloryr.allmusic.music.search.SearchPage;
|
||||
import coloryr.allmusic.objs.SearchOBJ;
|
||||
import coloryr.allmusic.objs.music.SearchPageObj;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.utils.Logs;
|
||||
import com.google.gson.JsonObject;
|
||||
import okhttp3.Cookie;
|
||||
@@ -33,8 +33,8 @@ public class APIMain {
|
||||
public APIMain() {
|
||||
AllMusic.log.info("§d[AllMusic]§e正在初始化网络爬虫");
|
||||
HttpClientUtil.init();
|
||||
HttpRes res = HttpClientUtil.get("https://music.163.com", "");
|
||||
if (res == null || !res.isOk()) {
|
||||
HttpResObj res = HttpClientUtil.get("https://music.163.com", "");
|
||||
if (res == null || !res.ok) {
|
||||
AllMusic.log.info("§d[AllMusic]§c初始化网络爬虫连接失败");
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,8 @@ public class APIMain {
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("ctcode", "86");
|
||||
params.addProperty("cellphone", AllMusic.getConfig().LoginUser);
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/api/sms/captcha/sent", params, EncryptType.WEAPI, null);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§d已发送验证码\n" + res.getData());
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/api/sms/captcha/sent", params, EncryptType.WEAPI, null);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§d已发送验证码\n" + res.data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,24 +85,24 @@ public class APIMain {
|
||||
params.addProperty("countrycode", "86");
|
||||
params.addProperty("phone", AllMusic.getConfig().LoginUser);
|
||||
params.addProperty("captcha", code);
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/eapi/w/login/cellphone", params, EncryptType.WEAPI, null);
|
||||
if (res == null || !res.isOk()) {
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/eapi/w/login/cellphone", params, EncryptType.WEAPI, null);
|
||||
if (res == null || !res.ok) {
|
||||
if (sender == null)
|
||||
AllMusic.log.info("§d[AllMusic]§c登录失败");
|
||||
else
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§c登录失败");
|
||||
return;
|
||||
}
|
||||
if (res.getData().contains("200")) {
|
||||
if (res.data.contains("200")) {
|
||||
if (sender == null)
|
||||
AllMusic.log.info("§d[AllMusic]§d已登录");
|
||||
else
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§d已登录");
|
||||
} else {
|
||||
if (sender == null)
|
||||
AllMusic.log.info("§d[AllMusic]§c登录失败:账号或密码错误\n" + res.getData());
|
||||
AllMusic.log.info("§d[AllMusic]§c登录失败:账号或密码错误\n" + res.data);
|
||||
else
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§c登录失败:账号或密码错误\n" + res.getData());
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§c登录失败:账号或密码错误\n" + res.data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,24 +114,24 @@ public class APIMain {
|
||||
* @param isList 是否是空闲列表
|
||||
* @return 结果
|
||||
*/
|
||||
private SongInfo getMusicDetail(String id, String player, boolean isList) {
|
||||
private SongInfoObj getMusicDetail(String id, String player, boolean isList) {
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("c", "[{\"id\":" + id + "}]");
|
||||
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/api/v3/song/detail", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.isOk()) {
|
||||
InfoOBJ temp = AllMusic.gson.fromJson(res.getData(), InfoOBJ.class);
|
||||
if (temp.isok()) {
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/api/v3/song/detail", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.ok) {
|
||||
InfoOBJ temp = AllMusic.gson.fromJson(res.data, InfoOBJ.class);
|
||||
if (temp.isOk()) {
|
||||
params = new JsonObject();
|
||||
params.addProperty("ids", "[" + id + "]");
|
||||
params.addProperty("br", "320000");
|
||||
res = HttpClientUtil.post("https://music.163.com/weapi/song/enhance/player/url", params, EncryptType.WEAPI, null);
|
||||
if (res == null || !res.isOk()) {
|
||||
if (res == null || !res.ok) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c版权检索失败");
|
||||
return null;
|
||||
}
|
||||
TrialInfoObj obj = AllMusic.gson.fromJson(res.getData(), TrialInfoObj.class);
|
||||
return new SongInfo(temp.getAuthor(), temp.getName(),
|
||||
TrialInfoObj obj = AllMusic.gson.fromJson(res.data, TrialInfoObj.class);
|
||||
return new SongInfoObj(temp.getAuthor(), temp.getName(),
|
||||
id, temp.getAlia(), player, temp.getAl(), isList, temp.getLength(),
|
||||
temp.getPicUrl(), obj.isTrial(), obj.getFreeTrialInfo());
|
||||
}
|
||||
@@ -147,17 +147,17 @@ public class APIMain {
|
||||
* @param isList 是否是空闲列表
|
||||
* @return 结果
|
||||
*/
|
||||
public SongInfo getMusic(String id, String player, boolean isList) {
|
||||
SongInfo info = getMusicDetail(id, player, isList);
|
||||
public SongInfoObj getMusic(String id, String player, boolean isList) {
|
||||
SongInfoObj info = getMusicDetail(id, player, isList);
|
||||
if (info != null)
|
||||
return info;
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("id", id);
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/api/dj/program/detail", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.isOk()) {
|
||||
PrInfoOBJ temp = AllMusic.gson.fromJson(res.getData(), PrInfoOBJ.class);
|
||||
if (temp.isOK()) {
|
||||
return new SongInfo(temp.getAuthor(), temp.getName(),
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/api/dj/program/detail", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.ok) {
|
||||
PrInfoOBJ temp = AllMusic.gson.fromJson(res.data, PrInfoOBJ.class);
|
||||
if (temp.isOk()) {
|
||||
return new SongInfoObj(temp.getAuthor(), temp.getName(),
|
||||
temp.getId(), temp.getAlia(), player, "电台", isList, temp.getLength(),
|
||||
null, false, null);
|
||||
} else {
|
||||
@@ -177,13 +177,13 @@ public class APIMain {
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("ids", "[" + id + "]");
|
||||
params.addProperty("br", AllMusic.getConfig().MusicBR);
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/weapi/song/enhance/player/url", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.isOk()) {
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/weapi/song/enhance/player/url", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.ok) {
|
||||
try {
|
||||
TrialInfoObj obj = AllMusic.gson.fromJson(res.getData(), TrialInfoObj.class);
|
||||
TrialInfoObj obj = AllMusic.gson.fromJson(res.data, TrialInfoObj.class);
|
||||
return obj.getUrl();
|
||||
} catch (Exception e) {
|
||||
Logs.logWrite(res.getData());
|
||||
Logs.logWrite(res.data);
|
||||
AllMusic.log.warning("§d[AllMusic]§c播放连接解析错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -203,11 +203,11 @@ public class APIMain {
|
||||
params.addProperty("id", id);
|
||||
params.addProperty("n", 100000);
|
||||
params.addProperty("s", 8);
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/api/v6/playlist/detail", params, EncryptType.API, null);
|
||||
if (res != null && res.isOk())
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/api/v6/playlist/detail", params, EncryptType.API, null);
|
||||
if (res != null && res.ok)
|
||||
try {
|
||||
isUpdata = true;
|
||||
DataOBJ obj = AllMusic.gson.fromJson(res.getData(), DataOBJ.class);
|
||||
DataOBJ obj = AllMusic.gson.fromJson(res.data, DataOBJ.class);
|
||||
AllMusic.getConfig().PlayList.addAll(obj.getPlaylist());
|
||||
AllMusic.save();
|
||||
AllMusic.side.sendMessaget(sender, AllMusic.getMessage().MusicPlay.ListMusic.Get.replace("%ListName%", obj.getName()));
|
||||
@@ -226,18 +226,18 @@ public class APIMain {
|
||||
* @param id 歌曲id
|
||||
* @return 结果
|
||||
*/
|
||||
public LyricSave getLyric(String id) {
|
||||
LyricSave Lyric = new LyricSave();
|
||||
public LyricSaveObj getLyric(String id) {
|
||||
LyricSaveObj Lyric = new LyricSaveObj();
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("id", id);
|
||||
params.addProperty("lv", -1);
|
||||
params.addProperty("kv", -1);
|
||||
params.addProperty("tv", -1);
|
||||
params.addProperty("rv", -1);
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/api/song/lyric?_nmclfl=1", params, EncryptType.API, null);
|
||||
if (res != null && res.isOk()) {
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/api/song/lyric?_nmclfl=1", params, EncryptType.API, null);
|
||||
if (res != null && res.ok) {
|
||||
try {
|
||||
WLyricOBJ obj = AllMusic.gson.fromJson(res.getData(), WLyricOBJ.class);
|
||||
WLyricOBJ obj = AllMusic.gson.fromJson(res.data, WLyricOBJ.class);
|
||||
LyricDo temp = new LyricDo();
|
||||
for (int times = 0; times < 3; times++) {
|
||||
if (temp.check(obj)) {
|
||||
@@ -267,7 +267,7 @@ public class APIMain {
|
||||
* @param isDefault 是否是默认方式
|
||||
* @return 结果
|
||||
*/
|
||||
public SearchPage search(String[] name, boolean isDefault) {
|
||||
public SearchPageObj search(String[] name, boolean isDefault) {
|
||||
List<SearchOBJ> resData = new ArrayList<>();
|
||||
int maxpage;
|
||||
|
||||
@@ -284,10 +284,10 @@ public class APIMain {
|
||||
params.addProperty("limit", 30);
|
||||
params.addProperty("offset", 0);
|
||||
|
||||
HttpRes res = HttpClientUtil.post("https://music.163.com/weapi/search/get", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.isOk()) {
|
||||
SearchDataOBJ obj = AllMusic.gson.fromJson(res.getData(), SearchDataOBJ.class);
|
||||
if (obj != null && obj.isok()) {
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/weapi/search/get", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.ok) {
|
||||
SearchDataOBJ obj = AllMusic.gson.fromJson(res.data, SearchDataOBJ.class);
|
||||
if (obj != null && obj.isOk()) {
|
||||
List<songs> res1 = obj.getResult();
|
||||
SearchOBJ item;
|
||||
for (songs temp : res1) {
|
||||
@@ -295,7 +295,7 @@ public class APIMain {
|
||||
resData.add(item);
|
||||
}
|
||||
maxpage = res1.size() / 10;
|
||||
return new SearchPage(resData, maxpage);
|
||||
return new SearchPageObj(resData, maxpage);
|
||||
} else {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲搜索出现错误");
|
||||
|
||||
|
||||
+6
-5
@@ -1,6 +1,7 @@
|
||||
package coloryr.allmusic.music.api.http;
|
||||
package coloryr.allmusic.music.api;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.objs.api.EncResObj;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
@@ -107,19 +108,19 @@ public class CryptoUtil {
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public static EncRes weapiEncrypt(String content) {
|
||||
public static EncResObj weapiEncrypt(String content) {
|
||||
String key = createSecretKey(16);
|
||||
String encText = aesEncrypt(aesEncrypt(content, presetKey, iv), key, iv);
|
||||
String encSecKey = rsaEncrypt(key);
|
||||
return new EncRes(encText, encSecKey);
|
||||
return new EncResObj(encText, encSecKey);
|
||||
}
|
||||
|
||||
public static EncRes eapi(String url, JsonObject object) {
|
||||
public static EncResObj eapi(String url, JsonObject object) {
|
||||
String text = AllMusic.gson.toJson(object);
|
||||
String message = "nobody" + url + "use" + text + "md5forencrypt";
|
||||
String digest = getMd5(message);
|
||||
String data = url + "-36cd479b6b5-" + text + "-36cd479b6b5-" + digest;
|
||||
return new EncRes(aesEncrypt(data, eapiKey), "");
|
||||
return new EncResObj(aesEncrypt(data, eapiKey), "");
|
||||
}
|
||||
|
||||
public static String getMd5(String plainText) {
|
||||
+9
-6
@@ -1,6 +1,9 @@
|
||||
package coloryr.allmusic.music.api.http;
|
||||
package coloryr.allmusic.music.api;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.enums.EncryptType;
|
||||
import coloryr.allmusic.objs.HttpResObj;
|
||||
import coloryr.allmusic.objs.api.EncResObj;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import okhttp3.*;
|
||||
@@ -34,7 +37,7 @@ public class HttpClientUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static HttpRes get(String path, String data) {
|
||||
public static HttpResObj get(String path, String data) {
|
||||
try {
|
||||
data = URLEncoder.encode(data, "UTF-8");
|
||||
Request request = new Request.Builder().url(path + data)
|
||||
@@ -62,7 +65,7 @@ public class HttpClientUtil {
|
||||
if (!ok) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c服务器返回错误:" + data1);
|
||||
}
|
||||
return new HttpRes(data1, ok);
|
||||
return new HttpResObj(data1, ok);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c获取网页错误");
|
||||
e.printStackTrace();
|
||||
@@ -70,13 +73,13 @@ public class HttpClientUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static HttpRes post(String url, JsonObject data, EncryptType type, String ourl) {
|
||||
public static HttpResObj post(String url, JsonObject data, EncryptType type, String ourl) {
|
||||
try {
|
||||
RequestBody formBody;
|
||||
Request.Builder request = new Request.Builder();
|
||||
request = request.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
request = request.addHeader("Referer", "https://music.163.com");
|
||||
EncRes res;
|
||||
EncResObj res;
|
||||
List<Cookie> cookies = new ArrayList<>();
|
||||
if (AllMusic.cookie.cookieStore.containsKey("music.163.com")) {
|
||||
cookies = AllMusic.cookie.cookieStore.get("music.163.com");
|
||||
@@ -158,7 +161,7 @@ public class HttpClientUtil {
|
||||
if (!ok) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c服务器返回错误:" + data1);
|
||||
}
|
||||
return new HttpRes(data1, ok);
|
||||
return new HttpResObj(data1, ok);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c获取网页错误");
|
||||
e.printStackTrace();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.http;
|
||||
package coloryr.allmusic.music.api;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import okhttp3.Cookie;
|
||||
@@ -1,19 +0,0 @@
|
||||
package coloryr.allmusic.music.api.http;
|
||||
|
||||
public class HttpRes {
|
||||
private final String data;
|
||||
private final boolean ok;
|
||||
|
||||
public HttpRes(String data, boolean ok) {
|
||||
this.data = data;
|
||||
this.ok = ok;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public boolean isOk() {
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
+8
-7
@@ -1,17 +1,18 @@
|
||||
package coloryr.allmusic.music.lyric;
|
||||
package coloryr.allmusic.music.play;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.music.api.obj.music.lyric.WLyricOBJ;
|
||||
import coloryr.allmusic.objs.api.music.lyric.WLyricOBJ;
|
||||
import coloryr.allmusic.objs.music.LyricItemObj;
|
||||
import coloryr.allmusic.utils.Function;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class LyricDo {
|
||||
|
||||
private final Map<Integer, LyricItem> temp = new HashMap<>();
|
||||
private final Map<Integer, LyricItemObj> temp = new HashMap<>();
|
||||
public boolean isHave = false;
|
||||
|
||||
public Map<Integer, LyricItem> getTemp() {
|
||||
public Map<Integer, LyricItemObj> getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -24,7 +25,7 @@ public class LyricDo {
|
||||
String[] lyric;
|
||||
|
||||
boolean haveT = false;
|
||||
if (!obj.isok())
|
||||
if (!obj.isOk())
|
||||
return true;
|
||||
else if (obj.isNone())
|
||||
return false;
|
||||
@@ -38,12 +39,12 @@ public class LyricDo {
|
||||
if (haveT) {
|
||||
Map<Integer, String> temp1 = getTime(Tlyric);
|
||||
for (Map.Entry<Integer, String> item : temp.entrySet()) {
|
||||
this.temp.put(item.getKey(), new LyricItem(haveT,
|
||||
this.temp.put(item.getKey(), new LyricItemObj(haveT,
|
||||
item.getValue(), temp1.get(item.getKey())));
|
||||
}
|
||||
} else {
|
||||
for (Map.Entry<Integer, String> item : temp.entrySet()) {
|
||||
this.temp.put(item.getKey(), new LyricItem(haveT,
|
||||
this.temp.put(item.getKey(), new LyricItemObj(haveT,
|
||||
item.getValue(), null));
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,8 @@ package coloryr.allmusic.music.play;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.command.CommandEX;
|
||||
import coloryr.allmusic.music.search.SearchPage;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import coloryr.allmusic.objs.music.SearchPageObj;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
@@ -16,7 +17,7 @@ public class MusicSearch {
|
||||
try {
|
||||
MusicObj obj = tasks.poll();
|
||||
if (obj != null) {
|
||||
SearchPage search = AllMusic.getMusicApi().search(obj.args, obj.isDefault);
|
||||
SearchPageObj search = AllMusic.getMusicApi().search(obj.args, obj.isDefault);
|
||||
if (search == null)
|
||||
AllMusic.side.sendMessaget(obj.sender, AllMusic.getMessage().Search
|
||||
.CantSearch.replace("%Music%", obj.isDefault ? obj.args[0] : obj.args[1]));
|
||||
|
||||
@@ -2,8 +2,9 @@ package coloryr.allmusic.music.play;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.hud.HudUtils;
|
||||
import coloryr.allmusic.music.lyric.LyricItem;
|
||||
import coloryr.allmusic.music.lyric.LyricSave;
|
||||
import coloryr.allmusic.objs.music.LyricItemObj;
|
||||
import coloryr.allmusic.objs.music.LyricSaveObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -98,7 +99,7 @@ public class PlayGo {
|
||||
}
|
||||
|
||||
private static void time2() {
|
||||
LyricItem show = PlayMusic.lyric.checkTime(PlayMusic.musicNowTime);
|
||||
LyricItemObj show = PlayMusic.lyric.checkTime(PlayMusic.musicNowTime);
|
||||
if (show != null) {
|
||||
PlayMusic.lyricItem = show;
|
||||
times = 0;
|
||||
@@ -137,7 +138,7 @@ public class PlayGo {
|
||||
}
|
||||
Thread.sleep(50);
|
||||
} else {
|
||||
AllMusic.side.sendHudSaveAll();
|
||||
AllMusic.side.sendHudUtilsAll();
|
||||
PlayMusic.nowPlayMusic = PlayMusic.remove(0);
|
||||
if (AllMusic.side.onMusicPlay(PlayMusic.nowPlayMusic)) {
|
||||
AllMusic.side.bqt(AllMusic.getMessage().MusicPlay.Cancel);
|
||||
@@ -156,7 +157,7 @@ public class PlayGo {
|
||||
if (PlayMusic.nowPlayMusic.getPlayerUrl() == null)
|
||||
PlayMusic.lyric = AllMusic.getMusicApi().getLyric(PlayMusic.nowPlayMusic.getID());
|
||||
else
|
||||
PlayMusic.lyric = new LyricSave();
|
||||
PlayMusic.lyric = new LyricSaveObj();
|
||||
|
||||
if (PlayMusic.nowPlayMusic.getLength() != 0) {
|
||||
PlayMusic.musicAllTime = PlayMusic.musicLessTime = (PlayMusic.nowPlayMusic.getLength() / 1000) + 3;
|
||||
|
||||
@@ -3,9 +3,10 @@ package coloryr.allmusic.music.play;
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.decoder.Bitstream;
|
||||
import coloryr.allmusic.decoder.Header;
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.music.lyric.LyricItem;
|
||||
import coloryr.allmusic.music.lyric.LyricSave;
|
||||
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;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
@@ -22,7 +23,7 @@ public class PlayMusic {
|
||||
/**
|
||||
* 播放列表
|
||||
*/
|
||||
private static final List<SongInfo> playList = new CopyOnWriteArrayList<>();
|
||||
private static final List<SongInfoObj> playList = new CopyOnWriteArrayList<>();
|
||||
/**
|
||||
* 投票时间
|
||||
*/
|
||||
@@ -42,16 +43,16 @@ public class PlayMusic {
|
||||
/**
|
||||
* 当前歌曲信息
|
||||
*/
|
||||
public static SongInfo nowPlayMusic;
|
||||
public static SongInfoObj nowPlayMusic;
|
||||
|
||||
/**
|
||||
* 当前歌词信息
|
||||
*/
|
||||
public static LyricSave lyric;
|
||||
public static LyricSaveObj lyric;
|
||||
/**
|
||||
* 当前歌词
|
||||
*/
|
||||
public static LyricItem lyricItem;
|
||||
public static LyricItemObj lyricItem;
|
||||
/**
|
||||
* 错误次数
|
||||
*/
|
||||
@@ -121,7 +122,7 @@ public class PlayMusic {
|
||||
}
|
||||
Logs.logWrite("玩家:" + player + " 点歌:" + id);
|
||||
try {
|
||||
SongInfo info = AllMusic.getMusicApi().getMusic(id, player, isList);
|
||||
SongInfoObj info = AllMusic.getMusicApi().getMusic(id, player, isList);
|
||||
if (info == null) {
|
||||
if (sender != null) {
|
||||
String data = AllMusic.getMessage().MusicPlay.NoCanPlay;
|
||||
@@ -174,7 +175,7 @@ public class PlayMusic {
|
||||
* 获取当前播放列表
|
||||
* @return 播放列表
|
||||
*/
|
||||
public static List<SongInfo> getList() {
|
||||
public static List<SongInfoObj> getList() {
|
||||
return new ArrayList<>(playList);
|
||||
}
|
||||
|
||||
@@ -190,7 +191,7 @@ public class PlayMusic {
|
||||
* @param index 标号
|
||||
* @return 结果
|
||||
*/
|
||||
public static SongInfo remove(int index) {
|
||||
public static SongInfoObj remove(int index) {
|
||||
return playList.remove(index);
|
||||
}
|
||||
|
||||
@@ -201,7 +202,7 @@ public class PlayMusic {
|
||||
public static String getAllList() {
|
||||
StringBuilder list = new StringBuilder();
|
||||
String a;
|
||||
SongInfo info;
|
||||
SongInfoObj info;
|
||||
for (int i = 0; i < playList.size(); i++) {
|
||||
info = playList.get(i);
|
||||
a = AllMusic.getMessage().MusicPlay.ListMusic.Item;
|
||||
@@ -226,7 +227,7 @@ public class PlayMusic {
|
||||
public static boolean isHave(String id) {
|
||||
if (nowPlayMusic != null && nowPlayMusic.getID().equalsIgnoreCase(id))
|
||||
return true;
|
||||
for (SongInfo item : playList) {
|
||||
for (SongInfoObj item : playList) {
|
||||
if (item.getID().equalsIgnoreCase(id))
|
||||
return true;
|
||||
}
|
||||
@@ -251,7 +252,7 @@ public class PlayMusic {
|
||||
} else {
|
||||
le = (int) h.total_ms(b);
|
||||
}
|
||||
SongInfo info = new SongInfo(AllMusic.getMessage().Custom.Info, url, le);
|
||||
SongInfoObj info = new SongInfoObj(AllMusic.getMessage().Custom.Info, url, le);
|
||||
playList.add(info);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲信息解析错误");
|
||||
|
||||
+10
-27
@@ -1,6 +1,8 @@
|
||||
package coloryr.allmusic;
|
||||
package coloryr.allmusic.objs;
|
||||
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.objs.hud.SaveOBJ;
|
||||
import coloryr.allmusic.objs.config.EconomyObj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -124,26 +126,7 @@ public class ConfigOBJ {
|
||||
/**
|
||||
* 经济插件挂钩
|
||||
*/
|
||||
public Economys Economys;
|
||||
|
||||
public static class Economys {
|
||||
public String MysqlUrl;
|
||||
public boolean Vault;
|
||||
|
||||
public Economys() {
|
||||
MysqlUrl = "jdbc:mysql://localhost:3306/minecraft?autoReconnect=true&autoReconnectForPools=true";
|
||||
Vault = true;
|
||||
}
|
||||
|
||||
public boolean check() {
|
||||
boolean res = false;
|
||||
if (MysqlUrl == null)
|
||||
res = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
public EconomyObj Economy;
|
||||
|
||||
public ConfigOBJ() {
|
||||
MaxList = 10;
|
||||
@@ -180,7 +163,7 @@ public class ConfigOBJ {
|
||||
MessageLimit = false;
|
||||
MessageLimitSize = 40;
|
||||
|
||||
Economys = new Economys();
|
||||
Economy = new EconomyObj();
|
||||
|
||||
Version = AllMusic.version;
|
||||
}
|
||||
@@ -228,12 +211,12 @@ public class ConfigOBJ {
|
||||
saveConfig = true;
|
||||
NoMusicServer = new ArrayList<>();
|
||||
}
|
||||
if (Economys == null) {
|
||||
if (Economy == null) {
|
||||
saveConfig = true;
|
||||
Economys = new Economys();
|
||||
} else if (Economys.check()) {
|
||||
Economy = new EconomyObj();
|
||||
} else if (Economy.check()) {
|
||||
saveConfig = true;
|
||||
Economys = new Economys();
|
||||
Economy = new EconomyObj();
|
||||
}
|
||||
|
||||
return saveConfig;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.http;
|
||||
package coloryr.allmusic.objs;
|
||||
|
||||
import okhttp3.Cookie;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package coloryr.allmusic.objs;
|
||||
|
||||
public class HttpResObj {
|
||||
public final String data;
|
||||
public final boolean ok;
|
||||
|
||||
public HttpResObj(String data, boolean ok) {
|
||||
this.data = data;
|
||||
this.ok = ok;
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -1,6 +1,8 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.objs.message.*;
|
||||
import coloryr.allmusic.objs.message.SearchOBJ;
|
||||
|
||||
public class MessageOBJ {
|
||||
public MusicPlayOBJ MusicPlay;
|
||||
@@ -8,7 +10,7 @@ public class MessageOBJ {
|
||||
public PageOBJ Page;
|
||||
public LyricOBJ Lyric;
|
||||
public VoteOBJ Vote;
|
||||
public SearchOBJ Search;
|
||||
public coloryr.allmusic.objs.message.SearchOBJ Search;
|
||||
public HudOBJ Hud;
|
||||
public HudListOBJ HudList;
|
||||
public CommandOBJ Command;
|
||||
@@ -25,7 +27,7 @@ public class MessageOBJ {
|
||||
Page = new PageOBJ();
|
||||
Lyric = new LyricOBJ();
|
||||
Vote = new VoteOBJ();
|
||||
Search = new SearchOBJ();
|
||||
Search = new coloryr.allmusic.objs.message.SearchOBJ();
|
||||
Hud = new HudOBJ();
|
||||
Command = new CommandOBJ();
|
||||
HudList = new HudListOBJ();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.search;
|
||||
package coloryr.allmusic.objs;
|
||||
|
||||
public class SearchOBJ {
|
||||
public final String id;
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package coloryr.allmusic.music.api.http;
|
||||
package coloryr.allmusic.objs.api;
|
||||
|
||||
public class EncRes {
|
||||
public class EncResObj {
|
||||
public String params;
|
||||
public String encSecKey;
|
||||
|
||||
public EncRes(String params, String encSecKey) {
|
||||
public EncResObj(String params, String encSecKey) {
|
||||
this.encSecKey = encSecKey;
|
||||
this.params = params;
|
||||
}
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package coloryr.allmusic.music.api.obj.music.info;
|
||||
package coloryr.allmusic.objs.api.music.info;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InfoOBJ {
|
||||
private List<Songs> songs;
|
||||
|
||||
public boolean isok() {
|
||||
public boolean isOk() {
|
||||
return (songs != null && songs.size() != 0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.obj.music.info;
|
||||
package coloryr.allmusic.objs.api.music.info;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.obj.music.list;
|
||||
package coloryr.allmusic.objs.api.music.list;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.obj.music.lyric;
|
||||
package coloryr.allmusic.objs.api.music.lyric;
|
||||
|
||||
public class WLyricOBJ {
|
||||
private lrc lrc;
|
||||
@@ -6,7 +6,7 @@ public class WLyricOBJ {
|
||||
private boolean nolyric;
|
||||
private boolean uncollected;
|
||||
|
||||
public boolean isok() {
|
||||
public boolean isOk() {
|
||||
return lrc != null || isNone();
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package coloryr.allmusic.music.api.obj.music.search;
|
||||
package coloryr.allmusic.objs.api.music.search;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SearchDataOBJ {
|
||||
private result result;
|
||||
|
||||
public boolean isok() {
|
||||
public boolean isOk() {
|
||||
return result != null && result.getSongs() != null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.obj.music.search;
|
||||
package coloryr.allmusic.objs.api.music.search;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.obj.music.trialinfo;
|
||||
package coloryr.allmusic.objs.api.music.trialinfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.api.obj.music.trialinfo;
|
||||
package coloryr.allmusic.objs.api.music.trialinfo;
|
||||
|
||||
public class freeTrialInfo {
|
||||
private int start;
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package coloryr.allmusic.music.api.obj.program.info;
|
||||
package coloryr.allmusic.objs.api.program.info;
|
||||
|
||||
public class PrInfoOBJ {
|
||||
|
||||
private program program;
|
||||
|
||||
public boolean isOK() {
|
||||
public boolean isOk() {
|
||||
return (program != null && program.getMainSong().getName() != null);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package coloryr.allmusic.objs.config;
|
||||
|
||||
public class EconomyObj {
|
||||
public String MysqlUrl;
|
||||
public boolean Vault;
|
||||
|
||||
public EconomyObj() {
|
||||
MysqlUrl = "jdbc:mysql://localhost:3306/minecraft?autoReconnect=true&autoReconnectForPools=true";
|
||||
Vault = true;
|
||||
}
|
||||
|
||||
public boolean check() {
|
||||
boolean res = false;
|
||||
if (MysqlUrl == null)
|
||||
res = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.hud.obj;
|
||||
package coloryr.allmusic.objs.hud;
|
||||
|
||||
public class PosOBJ {
|
||||
public int x;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.hud.obj;
|
||||
package coloryr.allmusic.objs.hud;
|
||||
|
||||
public class SaveOBJ {
|
||||
public PosOBJ List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class AddMusicOBJ {
|
||||
public String ListFull;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class ClickObj {
|
||||
public String This;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class CommandOBJ {
|
||||
public String Error;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class CostObj {
|
||||
public String Search;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class CustomOBJ {
|
||||
public String Info;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class HelpAdminObj {
|
||||
public String Reload;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class HelpNormalObj {
|
||||
public String Head;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class HelpObj {
|
||||
public HelpNormalObj Normal;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class HudListOBJ {
|
||||
public String List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class HudOBJ {
|
||||
public String State;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class ListMusicOBJ {
|
||||
public String Head;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class LyricOBJ {
|
||||
public String Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class MusicPlayOBJ {
|
||||
public String StopPlay;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class PAPIOBJ {
|
||||
public String NoMusic;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class PageOBJ {
|
||||
public String Choice;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class SearchOBJ {
|
||||
public String NoPer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.message;
|
||||
package coloryr.allmusic.objs.message;
|
||||
|
||||
public class VoteOBJ {
|
||||
public String NoPermission;
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
package coloryr.allmusic.music.lyric;
|
||||
package coloryr.allmusic.objs.music;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
|
||||
public class LyricItem {
|
||||
public class LyricItemObj {
|
||||
protected boolean haveT;
|
||||
protected String lyric;
|
||||
protected String tlyric;
|
||||
|
||||
public LyricItem(boolean haveT, String lyric, String tlyric) {
|
||||
public LyricItemObj(boolean haveT, String lyric, String tlyric) {
|
||||
this.haveT = haveT;
|
||||
this.lyric = lyric;
|
||||
this.tlyric = tlyric;
|
||||
+8
-6
@@ -1,18 +1,20 @@
|
||||
package coloryr.allmusic.music.lyric;
|
||||
package coloryr.allmusic.objs.music;
|
||||
|
||||
import coloryr.allmusic.objs.music.LyricItemObj;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class LyricSave {
|
||||
private Map<Integer, LyricItem> lyric;
|
||||
public class LyricSaveObj {
|
||||
private Map<Integer, LyricItemObj> lyric;
|
||||
private boolean haveLyric;
|
||||
|
||||
public LyricSave() {
|
||||
public LyricSaveObj() {
|
||||
haveLyric = false;
|
||||
lyric = new HashMap<>();
|
||||
}
|
||||
|
||||
public void setLyric(Map<Integer, LyricItem> lyric) {
|
||||
public void setLyric(Map<Integer, LyricItemObj> lyric) {
|
||||
this.lyric = lyric;
|
||||
}
|
||||
|
||||
@@ -24,7 +26,7 @@ public class LyricSave {
|
||||
this.haveLyric = haveLyric;
|
||||
}
|
||||
|
||||
public LyricItem checkTime(int playNow) {
|
||||
public LyricItemObj checkTime(int playNow) {
|
||||
if (lyric == null)
|
||||
return null;
|
||||
if (lyric.containsKey(playNow))
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.music.play;
|
||||
package coloryr.allmusic.objs.music;
|
||||
|
||||
public class MusicObj {
|
||||
/**
|
||||
+5
-3
@@ -1,13 +1,15 @@
|
||||
package coloryr.allmusic.music.search;
|
||||
package coloryr.allmusic.objs.music;
|
||||
|
||||
import coloryr.allmusic.objs.SearchOBJ;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SearchPage {
|
||||
public class SearchPageObj {
|
||||
private final List<SearchOBJ> resData;
|
||||
private final int maxpage;
|
||||
private int page = 0;
|
||||
|
||||
public SearchPage(List<SearchOBJ> resData, int maxpage) {
|
||||
public SearchPageObj(List<SearchOBJ> resData, int maxpage) {
|
||||
this.resData = resData;
|
||||
this.maxpage = maxpage;
|
||||
}
|
||||
+6
-6
@@ -1,9 +1,9 @@
|
||||
package coloryr.allmusic.music.api;
|
||||
package coloryr.allmusic.objs.music;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.music.api.obj.music.trialinfo.freeTrialInfo;
|
||||
import coloryr.allmusic.objs.api.music.trialinfo.freeTrialInfo;
|
||||
|
||||
public class SongInfo {
|
||||
public class SongInfoObj {
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ public class SongInfo {
|
||||
*/
|
||||
protected boolean isUrl;
|
||||
|
||||
public SongInfo(String Name, String Url, int Length) {
|
||||
public SongInfoObj(String Name, String Url, int Length) {
|
||||
this.length = Length;
|
||||
playerUrl = Url;
|
||||
this.name = Name;
|
||||
@@ -68,8 +68,8 @@ public class SongInfo {
|
||||
isUrl = true;
|
||||
}
|
||||
|
||||
public SongInfo(String Author, String Name, String ID, String Alia, String Call, String Al,
|
||||
boolean isList, int Length, String picUrl, boolean isTrial, freeTrialInfo trialInfo) {
|
||||
public SongInfoObj(String Author, String Name, String ID, String Alia, String Call, String Al,
|
||||
boolean isList, int Length, String picUrl, boolean isTrial, freeTrialInfo trialInfo) {
|
||||
this.author = Author;
|
||||
this.name = Name;
|
||||
this.id = ID;
|
||||
+5
-3
@@ -1,7 +1,9 @@
|
||||
package coloryr.allmusic.music.lyric;
|
||||
package coloryr.allmusic.objs.music;
|
||||
|
||||
public class TopLyricItem extends LyricItem {
|
||||
public TopLyricItem() {
|
||||
import coloryr.allmusic.objs.music.LyricItemObj;
|
||||
|
||||
public class TopLyricItemObj extends LyricItemObj {
|
||||
public TopLyricItemObj() {
|
||||
super(false, null, null);
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
package coloryr.allmusic.music.api;
|
||||
package coloryr.allmusic.objs.music;
|
||||
|
||||
import coloryr.allmusic.music.api.obj.music.trialinfo.freeTrialInfo;
|
||||
import coloryr.allmusic.objs.api.music.trialinfo.freeTrialInfo;
|
||||
|
||||
public class TopSongInfo extends SongInfo {
|
||||
public TopSongInfo() {
|
||||
public class TopSongInfoObj extends SongInfoObj {
|
||||
public TopSongInfoObj() {
|
||||
super(null, null, 0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package coloryr.allmusic.side;
|
||||
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
|
||||
public interface ISide {
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ public interface ISide {
|
||||
/**
|
||||
* 发送Hud位置数据
|
||||
*/
|
||||
void sendHudSaveAll();
|
||||
void sendHudUtilsAll();
|
||||
|
||||
/**
|
||||
* 发送Bar数据
|
||||
@@ -177,7 +177,7 @@ public interface ISide {
|
||||
* @param obj 歌曲信息
|
||||
* @return 是否阻止播放
|
||||
*/
|
||||
boolean onMusicPlay(SongInfo obj);
|
||||
boolean onMusicPlay(SongInfoObj obj);
|
||||
|
||||
/**
|
||||
* 当歌曲播放时触发的事件
|
||||
|
||||
@@ -2,10 +2,10 @@ package coloryr.allmusic.side.bc;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.AllMusicBC;
|
||||
import coloryr.allmusic.hud.HudSave;
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.hud.HudUtils;
|
||||
import coloryr.allmusic.objs.hud.SaveOBJ;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import coloryr.allmusic.music.play.PlayMusic;
|
||||
import coloryr.allmusic.side.ComType;
|
||||
import coloryr.allmusic.side.ISide;
|
||||
@@ -18,7 +18,6 @@ import io.netty.buffer.Unpooled;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
@@ -51,7 +50,7 @@ public class SideBC implements ISide {
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
SaveOBJ obj = HudSave.get(player.getName());
|
||||
SaveOBJ obj = HudUtils.get(player.getName());
|
||||
if (!obj.EnableLyric)
|
||||
continue;
|
||||
send(player, ComType.lyric + data, null);
|
||||
@@ -68,7 +67,7 @@ public class SideBC implements ISide {
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
SaveOBJ obj = HudSave.get(player.getName());
|
||||
SaveOBJ obj = HudUtils.get(player.getName());
|
||||
if (!obj.EnableInfo)
|
||||
continue;
|
||||
send(player, ComType.info + data, null);
|
||||
@@ -86,7 +85,7 @@ public class SideBC implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnableList)
|
||||
continue;
|
||||
send(player, ComType.list + data, null);
|
||||
@@ -98,10 +97,10 @@ public class SideBC implements ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudSaveAll() {
|
||||
public void sendHudUtilsAll() {
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
try {
|
||||
SaveOBJ obj = HudSave.get(player.getName());
|
||||
SaveOBJ obj = HudUtils.get(player.getName());
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
send(player, data, null);
|
||||
} catch (Exception e1) {
|
||||
@@ -145,7 +144,7 @@ public class SideBC implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnablePic)
|
||||
continue;
|
||||
send(player, ComType.img + url, null);
|
||||
@@ -399,7 +398,7 @@ public class SideBC implements ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfo obj) {
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(event);
|
||||
return event.isCancel();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package coloryr.allmusic.side.bc.event;
|
||||
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package coloryr.allmusic.side.bc.event;
|
||||
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
/**
|
||||
@@ -10,17 +10,17 @@ public class MusicPlayEvent extends Event {
|
||||
/**
|
||||
* 音乐内容
|
||||
*/
|
||||
private final SongInfo music;
|
||||
private final SongInfoObj music;
|
||||
/**
|
||||
* 是否取消
|
||||
*/
|
||||
private boolean cancel = false;
|
||||
|
||||
public MusicPlayEvent(SongInfo music) {
|
||||
public MusicPlayEvent(SongInfoObj music) {
|
||||
this.music = music;
|
||||
}
|
||||
|
||||
public SongInfo getMusic() {
|
||||
public SongInfoObj getMusic() {
|
||||
return music;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package coloryr.allmusic.side.bukkit;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.AllMusicBukkit;
|
||||
import coloryr.allmusic.music.api.TopSongInfo;
|
||||
import coloryr.allmusic.music.lyric.TopLyricItem;
|
||||
import coloryr.allmusic.objs.music.TopSongInfoObj;
|
||||
import coloryr.allmusic.objs.music.TopLyricItemObj;
|
||||
import coloryr.allmusic.music.play.PlayMusic;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
@@ -24,12 +24,12 @@ public class PluginMessage implements PluginMessageListener {
|
||||
public static int size;
|
||||
public static String allList;
|
||||
public static boolean update = false;
|
||||
private final TopSongInfo info;
|
||||
private final TopLyricItem lyric;
|
||||
private final TopSongInfoObj info;
|
||||
private final TopLyricItemObj lyric;
|
||||
|
||||
public PluginMessage() {
|
||||
info = (TopSongInfo) PlayMusic.nowPlayMusic;
|
||||
lyric = (TopLyricItem) PlayMusic.lyricItem;
|
||||
info = (TopSongInfoObj) PlayMusic.nowPlayMusic;
|
||||
lyric = (TopLyricItemObj) PlayMusic.lyricItem;
|
||||
|
||||
service = Executors.newSingleThreadScheduledExecutor();
|
||||
service.scheduleAtFixedRate(PluginMessage::clear, 0, 30, TimeUnit.SECONDS);
|
||||
|
||||
@@ -2,10 +2,10 @@ package coloryr.allmusic.side.bukkit;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.AllMusicBukkit;
|
||||
import coloryr.allmusic.hud.HudSave;
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.hud.HudUtils;
|
||||
import coloryr.allmusic.objs.hud.SaveOBJ;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import coloryr.allmusic.side.ComType;
|
||||
import coloryr.allmusic.side.ISide;
|
||||
import coloryr.allmusic.side.bukkit.event.MusicAddEvent;
|
||||
@@ -83,7 +83,7 @@ public class SideBukkit implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnableLyric)
|
||||
continue;
|
||||
send(player, ComType.lyric + data, null);
|
||||
@@ -101,7 +101,7 @@ public class SideBukkit implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnableInfo)
|
||||
continue;
|
||||
send(player, ComType.info + data, null);
|
||||
@@ -119,7 +119,7 @@ public class SideBukkit implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnableList)
|
||||
continue;
|
||||
send(player, ComType.list + data, null);
|
||||
@@ -131,11 +131,11 @@ public class SideBukkit implements ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudSaveAll() {
|
||||
public void sendHudUtilsAll() {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
String Name = player.getName();
|
||||
try {
|
||||
SaveOBJ obj = HudSave.get(Name);
|
||||
SaveOBJ obj = HudUtils.get(Name);
|
||||
String data = new Gson().toJson(obj);
|
||||
send(player, data, null);
|
||||
} catch (Exception e1) {
|
||||
@@ -177,7 +177,7 @@ public class SideBukkit implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnablePic)
|
||||
continue;
|
||||
send(player, ComType.img + url, null);
|
||||
@@ -344,7 +344,7 @@ public class SideBukkit implements ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfo obj) {
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
Bukkit.getScheduler().callSyncMethod(AllMusicBukkit.plugin, () -> {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package coloryr.allmusic.side.bukkit.event;
|
||||
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package coloryr.allmusic.side.bukkit.event;
|
||||
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -13,17 +13,17 @@ public class MusicPlayEvent extends Event {
|
||||
/**
|
||||
* 音乐内容
|
||||
*/
|
||||
private final SongInfo music;
|
||||
private final SongInfoObj music;
|
||||
/**
|
||||
* 是否取消
|
||||
*/
|
||||
private boolean cancel = false;
|
||||
|
||||
public MusicPlayEvent(SongInfo music) {
|
||||
public MusicPlayEvent(SongInfoObj music) {
|
||||
this.music = music;
|
||||
}
|
||||
|
||||
public SongInfo getMusic() {
|
||||
public SongInfoObj getMusic() {
|
||||
return music;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ package coloryr.allmusic.side.velocity;
|
||||
|
||||
import coloryr.allmusic.AllMusic;
|
||||
import coloryr.allmusic.AllMusicVelocity;
|
||||
import coloryr.allmusic.hud.HudSave;
|
||||
import coloryr.allmusic.hud.obj.SaveOBJ;
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.hud.HudUtils;
|
||||
import coloryr.allmusic.objs.hud.SaveOBJ;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import coloryr.allmusic.music.play.PlayMusic;
|
||||
import coloryr.allmusic.side.ComType;
|
||||
import coloryr.allmusic.side.ISide;
|
||||
@@ -122,7 +122,7 @@ public class SideVelocity implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getUsername();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnablePic)
|
||||
continue;
|
||||
send(player, ComType.img + url, false);
|
||||
@@ -139,7 +139,7 @@ public class SideVelocity implements ISide {
|
||||
for (Player player : AllMusicVelocity.plugin.server.getAllPlayers()) {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
SaveOBJ obj = HudSave.get(player.getUsername());
|
||||
SaveOBJ obj = HudUtils.get(player.getUsername());
|
||||
if (!obj.EnableLyric)
|
||||
continue;
|
||||
send(player, ComType.lyric + data, null);
|
||||
@@ -156,7 +156,7 @@ public class SideVelocity implements ISide {
|
||||
for (Player player : AllMusicVelocity.plugin.server.getAllPlayers()) {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
SaveOBJ obj = HudSave.get(player.getUsername());
|
||||
SaveOBJ obj = HudUtils.get(player.getUsername());
|
||||
if (!obj.EnableInfo)
|
||||
continue;
|
||||
send(player, ComType.info + data, null);
|
||||
@@ -174,7 +174,7 @@ public class SideVelocity implements ISide {
|
||||
if (isOK(player))
|
||||
continue;
|
||||
String name = player.getUsername();
|
||||
SaveOBJ obj = HudSave.get(name);
|
||||
SaveOBJ obj = HudUtils.get(name);
|
||||
if (!obj.EnableList)
|
||||
continue;
|
||||
send(player, ComType.list + data, null);
|
||||
@@ -186,11 +186,11 @@ public class SideVelocity implements ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudSaveAll() {
|
||||
public void sendHudUtilsAll() {
|
||||
for (Player players : AllMusicVelocity.plugin.server.getAllPlayers()) {
|
||||
String Name = players.getUsername();
|
||||
try {
|
||||
SaveOBJ obj = HudSave.get(Name);
|
||||
SaveOBJ obj = HudUtils.get(Name);
|
||||
String data = new Gson().toJson(obj);
|
||||
send(data, Name, null);
|
||||
} catch (Exception e1) {
|
||||
@@ -379,7 +379,7 @@ public class SideVelocity implements ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfo obj) {
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
AllMusicVelocity.plugin.server.getEventManager().fire(event).join();
|
||||
return event.isCancel();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package coloryr.allmusic.side.velocity.event;
|
||||
|
||||
import coloryr.allmusic.music.play.MusicObj;
|
||||
import coloryr.allmusic.objs.music.MusicObj;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package coloryr.allmusic.side.velocity.event;
|
||||
|
||||
import coloryr.allmusic.music.api.SongInfo;
|
||||
import coloryr.allmusic.objs.music.SongInfoObj;
|
||||
|
||||
/**
|
||||
* 音乐播发事件
|
||||
@@ -9,17 +9,17 @@ public class MusicPlayEvent {
|
||||
/**
|
||||
* 音乐内容
|
||||
*/
|
||||
private final SongInfo music;
|
||||
private final SongInfoObj music;
|
||||
/**
|
||||
* 是否取消
|
||||
*/
|
||||
private boolean cancel = false;
|
||||
|
||||
public MusicPlayEvent(SongInfo music) {
|
||||
public MusicPlayEvent(SongInfoObj music) {
|
||||
this.music = music;
|
||||
}
|
||||
|
||||
public SongInfo getMusic() {
|
||||
public SongInfoObj getMusic() {
|
||||
return music;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user