mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-22 20:09:43 +00:00
up
This commit is contained in:
1 parent
cb23143522
commit
8d4bccd711
85 files changed
+2944
-1540
No files matched your search
@@ -1,10 +1,12 @@
|
||||
# AllMusic插件
|
||||
# AllMusic3
|
||||
|
||||
[AllMusic](https://github.com/Coloryr/AllMusic_Server)3.0版本
|
||||
|
||||
一个全服点歌插件
|
||||
|
||||

|
||||
|
||||
注:需要配合[客户端Mod](https://github.com/Coloryr/AllMusic_Client)使用
|
||||
注:需要配合[客户端Mod](https://github.com/Coloryr/AllMusic3_Client)使用
|
||||
|
||||
[下载地址](https://www.123pan.com/s/Nh4zVv-BjOAH.html)
|
||||
|
||||
@@ -23,21 +25,19 @@
|
||||
|
||||
## 使用方法
|
||||
>1. 安装AllMusic插件
|
||||
>复制`AllMusic-2.19.2-all.jar`到你的`plugins`文件夹
|
||||
>复制`AllMusic-3.0.0-all.jar`到你的`plugins`文件夹
|
||||
>重启过服务器
|
||||
>2. 安装客户端mod
|
||||
>目前只支持
|
||||
>`forge:1.7.10 1.8 1.12.2 1.14 1.15 1.16 1.17 1.18 1.19 1.20`
|
||||
>`fabric:1.14 1.15 1.16 1.17 1.18 1.19 1.20`
|
||||
>复制`[forge-xxx]AllMusic-2.6.8`到客户端的`mods`文件夹
|
||||
>fabric同理
|
||||
|
||||
如果你是forge或者fabric服务器,复制服务器mod到你的mods文件夹下即可
|
||||
需要补全前置mod kotlinforforge
|
||||
|
||||
## 播放VIP歌曲
|
||||
1. 手机号创建网易云账户并购买网易云音乐VIP
|
||||
2. 在插件配置文件的`LoginUser`填写手机号
|
||||
3. 重载插件或者重启服务器
|
||||
4. 输入/music code 获取手机验证码
|
||||
5. 输入/music login 验证码 登录账户
|
||||
2. 输入/music code 手机号码 获取手机验证码
|
||||
3. 输入/music login 验证码 登录账户
|
||||
|
||||
如果登录失效,请删除`cookie.json`再打`/music reload`再重新登录
|
||||
|
||||
@@ -57,74 +57,5 @@
|
||||
### 更新日志
|
||||
|
||||
```
|
||||
|
||||
插件:
|
||||
1.0.0:完成本体
|
||||
1.5.0:增加bukkit服务器支持
|
||||
1.6.0:增加歌曲搜索
|
||||
1.7.0:新增VV支持
|
||||
1.8.0:优化体验
|
||||
1.9.0:修复bug
|
||||
1.10.0:多API支持
|
||||
1.11.0:新的语言文件!
|
||||
1.12.0:新增PAPI
|
||||
1.12.1:新增本地API支持
|
||||
1.13.0:删除冗余代码
|
||||
1.13.3:删除API1
|
||||
1.14.0:增加本地API
|
||||
1.17.0:改进VV钩子
|
||||
2.0.0:显示HUD
|
||||
2.1.0:修复不能听歌的bug
|
||||
2.4.0:修bug
|
||||
2.5.0:增加花钱点歌
|
||||
2.6.2:删除spigot依赖
|
||||
2.7.0:支持个人歌单播放,修复登录bug
|
||||
2.8.0:Spigot和Bukkit分开支持
|
||||
2.9.0:自动安装外置API
|
||||
2.10.0:Velocity支持
|
||||
2.12.0:图片支持,完全内置API
|
||||
2.12.2:修复各种bug
|
||||
2.12.7:修复各种bug
|
||||
2.14.0:支持中途加入听歌
|
||||
2.14.5:修复网易云登录问题
|
||||
2.14.6:合并1.7.10分支,修复各种bug
|
||||
2.14.7:(我说是debug你信吗
|
||||
2.14.8:添加1.8支持
|
||||
2.14.10:修复1.7.10兼容问题
|
||||
2.16.0:新增群组服也能获取PAPI
|
||||
2.16.4:npc检测
|
||||
2.16.5:登录错误修复
|
||||
2.17.5:KTV歌词
|
||||
2.17.8:修复歌词问题
|
||||
2.17.9:修复播放检查问题
|
||||
2.17.10:修复播放完结列表错误
|
||||
2.18.0:图片旋转功能
|
||||
2.18.1:修复中途加入播放问题
|
||||
2.18.2:修复歌词问题
|
||||
2.18.3:修复BC的播放问题
|
||||
2.18.5:加入Mod服务器支持
|
||||
2.18.6:修复Mod服务器问题
|
||||
2.18.7:加入空白歌词设置
|
||||
2.18.8:修复Mod服务器点击事件问题
|
||||
2.18.9:添加folia服务端支持
|
||||
2.18.10:BC改名Top
|
||||
2.19.0:新增玩家点歌限制
|
||||
2.19.2:修复潜在的问题
|
||||
|
||||
MOD:
|
||||
1.2.0:无需指令就能修改音量
|
||||
1.3.0:优化问题,修复若干bug,新增自动停止播放音乐
|
||||
2.0.0:显示Hud
|
||||
2.0.5:1.16支持
|
||||
2.0.6:不知道什么更新
|
||||
2.1.0:修bug
|
||||
2.2.0:修复放歌中断
|
||||
2.5.0:图片支持
|
||||
2.5.9:FLAC支持,使用AL10,兼容boat
|
||||
2.5.10:AL10修改,GUI底层显示
|
||||
2.5.11:增加中途加入听歌
|
||||
2.6.0:新增图片大小调整
|
||||
2.6.3:1.19支持
|
||||
2.6.5:图片旋转
|
||||
2.6.8:尝试修复掉帧问题
|
||||
```
|
||||
3.0.0:将插件大部分重写
|
||||
```
|
||||
+51
-32
@@ -1,7 +1,7 @@
|
||||
package coloryr.allmusic.core;
|
||||
|
||||
import coloryr.allmusic.core.hud.DataSql;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.sql.DataSql;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
import coloryr.allmusic.core.music.api.APIMain;
|
||||
import coloryr.allmusic.core.music.play.MusicSearch;
|
||||
import coloryr.allmusic.core.music.play.PlayGo;
|
||||
@@ -37,24 +37,28 @@ public class AllMusic {
|
||||
/**
|
||||
* 插件版本号
|
||||
*/
|
||||
public static final String version = "2.19.4";
|
||||
public static final String version = "3.0.0";
|
||||
/**
|
||||
* 配置文件版本号
|
||||
*/
|
||||
public static final String configVersion = "105";
|
||||
public static final String configVersion = "200";
|
||||
/**
|
||||
* 语言文件配置版本号
|
||||
*/
|
||||
public static final String messageVersion = "106";
|
||||
public static final String messageVersion = "200";
|
||||
/**
|
||||
* 搜歌结果
|
||||
* 玩家名 结果
|
||||
*/
|
||||
private static final Map<String, SearchPageObj> searchSave = new HashMap<>();
|
||||
/**
|
||||
* 投票的玩家
|
||||
* 切歌投票的玩家
|
||||
*/
|
||||
private static final Set<String> votePlayer = new HashSet<>();
|
||||
/**
|
||||
* 插歌投票的玩家
|
||||
*/
|
||||
private static final Set<String> pushPlayer = new HashSet<>();
|
||||
/**
|
||||
* 正在播放的玩家
|
||||
*/
|
||||
@@ -114,7 +118,7 @@ public class AllMusic {
|
||||
public static void configCheck() {
|
||||
if (config == null || config.check()) {
|
||||
config = ConfigObj.make();
|
||||
log.warning("§d[AllMusic]§c配置文件config.json错误,已覆盖");
|
||||
log.warning("§d[AllMusic3]§c配置文件config.json错误,已覆盖");
|
||||
saveConfig();
|
||||
}
|
||||
}
|
||||
@@ -125,7 +129,7 @@ public class AllMusic {
|
||||
private static void messageCheck() {
|
||||
if (message == null || message.check()) {
|
||||
message = MessageObj.make();
|
||||
log.warning("§d[AllMusic]§c配置文件message.json错误,已覆盖");
|
||||
log.warning("§d[AllMusic3]§c配置文件message.json错误,已覆盖");
|
||||
saveMessage();
|
||||
}
|
||||
}
|
||||
@@ -140,9 +144,9 @@ public class AllMusic {
|
||||
*/
|
||||
public static boolean isOK(String name, String server, boolean checkList) {
|
||||
try {
|
||||
if (server != null && AllMusic.getConfig().NoMusicServer.contains(server))
|
||||
if (server != null && AllMusic.getConfig().muteServer.contains(server))
|
||||
return true;
|
||||
if (AllMusic.getConfig().NoMusicPlayer.contains(name))
|
||||
if (AllMusic.getConfig().mutePlayer.contains(name))
|
||||
return true;
|
||||
if(AllMusic.isPause(name))
|
||||
return true;
|
||||
@@ -171,7 +175,7 @@ public class AllMusic {
|
||||
*/
|
||||
public static ConfigObj getConfig() {
|
||||
if (config == null) {
|
||||
log.warning("§d[AllMusic]§c配置文件config.json错误,已使用默认配置文件");
|
||||
log.warning("§d[AllMusic3]§c配置文件config.json错误,已使用默认配置文件");
|
||||
config = ConfigObj.make();
|
||||
}
|
||||
return config;
|
||||
@@ -184,7 +188,7 @@ public class AllMusic {
|
||||
*/
|
||||
public static MessageObj getMessage() {
|
||||
if (message == null) {
|
||||
log.warning("§d[AllMusic]§c配置文件message.json错误,已使用默认配置文件");
|
||||
log.warning("§d[AllMusic3]§c配置文件message.json错误,已使用默认配置文件");
|
||||
message = MessageObj.make();
|
||||
}
|
||||
return message;
|
||||
@@ -228,6 +232,15 @@ public class AllMusic {
|
||||
votePlayer.add(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加投票的玩家
|
||||
*
|
||||
* @param player 用户名
|
||||
*/
|
||||
public static void addPush(String player){
|
||||
pushPlayer.add(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取投票数量
|
||||
*
|
||||
@@ -244,6 +257,10 @@ public class AllMusic {
|
||||
votePlayer.clear();
|
||||
}
|
||||
|
||||
public static void clearPush() {
|
||||
pushPlayer.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已经投票了
|
||||
*
|
||||
@@ -254,6 +271,10 @@ public class AllMusic {
|
||||
return votePlayer.contains(player);
|
||||
}
|
||||
|
||||
public static boolean containPush(String player) {
|
||||
return pushPlayer.contains(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加正在播放的玩家
|
||||
*
|
||||
@@ -293,7 +314,7 @@ public class AllMusic {
|
||||
write.close();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
log.warning("§d[AllMusic]§c配置文件保存错误");
|
||||
log.warning("§d[AllMusic3]§c配置文件保存错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -308,7 +329,7 @@ public class AllMusic {
|
||||
write.close();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
log.warning("§d[AllMusic]§c配置文件保存错误");
|
||||
log.warning("§d[AllMusic3]§c配置文件保存错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -325,7 +346,7 @@ public class AllMusic {
|
||||
write.write(data);
|
||||
write.close();
|
||||
} catch (Exception e) {
|
||||
log.warning("§d[AllMusic]§c配置文件保存错误");
|
||||
log.warning("§d[AllMusic3]§c配置文件保存错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -340,7 +361,7 @@ public class AllMusic {
|
||||
MusicSearch.start();
|
||||
DataSql.start();
|
||||
|
||||
log.info("§d[AllMusic]§e已启动-" + version);
|
||||
log.info("§d[AllMusic3]§e已启动-" + version);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,7 +379,7 @@ public class AllMusic {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log.info("§d[AllMusic]§2§e已停止,感谢使用");
|
||||
log.info("§d[AllMusic3]§2§e已停止,感谢使用");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,11 +411,11 @@ public class AllMusic {
|
||||
reader.close();
|
||||
messageCheck();
|
||||
|
||||
log.info("§d[AllMusic]§e当前语言配置文件版本为:" + messageVersion
|
||||
+ ",你的语言文件版本为:" + message.Version);
|
||||
log.info("§d[AllMusic3]§e当前语言配置文件版本为:" + messageVersion
|
||||
+ ",你的语言文件版本为:" + message.version);
|
||||
|
||||
if (!message.Version.equalsIgnoreCase(messageVersion)) {
|
||||
log.warning("§d[AllMusic]§c语言文件版本号错误,运行可能会发生问题,请删除后重载");
|
||||
if (!message.version.equalsIgnoreCase(messageVersion)) {
|
||||
log.warning("§d[AllMusic3]§c语言文件版本号错误,运行可能会发生问题,请删除后重载");
|
||||
}
|
||||
|
||||
reader = new InputStreamReader(Files.newInputStream(cookieFile.toPath()), StandardCharsets.UTF_8);
|
||||
@@ -407,14 +428,14 @@ public class AllMusic {
|
||||
saveCookie();
|
||||
}
|
||||
|
||||
log.info("§d[AllMusic]§e当前插件配置文件版本为:" + configVersion
|
||||
+ ",你的配置文件版本为:" + config.Version);
|
||||
log.info("§d[AllMusic3]§e当前插件配置文件版本为:" + configVersion
|
||||
+ ",你的配置文件版本为:" + config.version);
|
||||
|
||||
if (!AllMusic.configVersion.equalsIgnoreCase(config.Version)) {
|
||||
log.warning("§d[AllMusic]§c请及时更新配置文件");
|
||||
if (!AllMusic.configVersion.equalsIgnoreCase(config.version)) {
|
||||
log.warning("§d[AllMusic3]§c请及时更新配置文件");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warning("§d[AllMusic]§c读取配置文件错误");
|
||||
log.warning("§d[AllMusic3]§c读取配置文件错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -425,16 +446,14 @@ public class AllMusic {
|
||||
* @param player 用户名
|
||||
*/
|
||||
public static void joinPlay(String player) {
|
||||
if (getConfig().NoMusicPlayer.contains(player) || nowPlayPlayer.contains(player)) {
|
||||
if (getConfig().mutePlayer.contains(player) || nowPlayPlayer.contains(player)) {
|
||||
pauseSendPlayer.remove(player);
|
||||
return;
|
||||
}
|
||||
|
||||
AllMusic.side.runTask(() -> {
|
||||
if (PlayMusic.nowPlayMusic != null) {
|
||||
SaveObj obj = HudUtils.get(player);
|
||||
String data = gson.toJson(obj);
|
||||
AllMusic.side.send(data, player);
|
||||
AllMusic.side.sendHudPos(player);
|
||||
AllMusic.side.sendMusic(player, PlayGo.url);
|
||||
if (!PlayMusic.nowPlayMusic.isUrl()) {
|
||||
AllMusic.side.runTask(() ->
|
||||
@@ -471,7 +490,7 @@ public class AllMusic {
|
||||
* @param file 配置文件文件夹
|
||||
*/
|
||||
public void init(File file) {
|
||||
log.info("§d[AllMusic]§2§e正在启动,感谢使用,本插件交流群:571239090");
|
||||
log.info("§d[AllMusic3]§2§e正在启动,感谢使用,本插件交流群:571239090");
|
||||
try {
|
||||
if (!file.exists())
|
||||
file.mkdir();
|
||||
@@ -501,7 +520,7 @@ public class AllMusic {
|
||||
isRun = true;
|
||||
} catch (IOException e) {
|
||||
isRun = false;
|
||||
log.warning("§d[AllMusic]§c启动失败");
|
||||
log.warning("§d[AllMusic3]§c启动失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
+13
-16
@@ -1,7 +1,7 @@
|
||||
package coloryr.allmusic.core;
|
||||
|
||||
import coloryr.allmusic.core.enums.HudPos;
|
||||
import coloryr.allmusic.core.side.ComType;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.objs.enums.ComType;
|
||||
|
||||
public class AllMusicAPI {
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ public class AllMusicAPI {
|
||||
* @param url 链接
|
||||
*/
|
||||
public static void playMusic(String name, String url) {
|
||||
AllMusic.side.send(name, ComType.play + url);
|
||||
AllMusic.side.sendMusic(name, url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,11 +21,8 @@ public class AllMusicAPI {
|
||||
* @param pos 位置
|
||||
* @param data 数据
|
||||
*/
|
||||
public static void sendHud(String name, HudPos pos, String data) {
|
||||
String temp = getType(pos);
|
||||
if (temp == null)
|
||||
return;
|
||||
AllMusic.side.send(name, temp + data);
|
||||
public static void sendHud(String name, HudType pos, String data) {
|
||||
AllMusic.side.sendHud(name, pos, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +32,7 @@ public class AllMusicAPI {
|
||||
* @param url 图片地址
|
||||
*/
|
||||
public static void sendPic(String name, String url) {
|
||||
AllMusic.side.send(name, ComType.img + url);
|
||||
AllMusic.side.sendPic(name, url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,14 +50,14 @@ public class AllMusicAPI {
|
||||
* @param pos 位置
|
||||
* @return 字符串
|
||||
*/
|
||||
private static String getType(HudPos pos) {
|
||||
private static ComType getType(HudType pos) {
|
||||
switch (pos) {
|
||||
case info:
|
||||
return ComType.info;
|
||||
case lyric:
|
||||
return ComType.lyric;
|
||||
case list:
|
||||
return ComType.list;
|
||||
case INFO:
|
||||
return ComType.INFO;
|
||||
case LYRIC:
|
||||
return ComType.LYRIC;
|
||||
case LIST:
|
||||
return ComType.LIST;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ACommand implements ICommand {
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
|
||||
public abstract class AHudCommand extends ACommand {
|
||||
protected final HudType type;
|
||||
|
||||
public AHudCommand(HudType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,18 @@ package coloryr.allmusic.core.command;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.utils.Function;
|
||||
|
||||
public class CommandAddList implements ICommand {
|
||||
public class CommandAddList extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
if (Function.isInteger(args[1])) {
|
||||
AllMusic.getMusicApi().setList(args[1], sender);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2添加空闲音乐列表" + args[1]);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2添加空闲音乐列表" + args[1]);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2请输入有效的音乐列表ID");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2请输入有效的音乐列表ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,43 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.utils.Function;
|
||||
|
||||
public class CommandBan implements ICommand {
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandBan extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
if (Function.isInteger(args[1])) {
|
||||
AllMusic.getConfig().addBanMusic(args[1]);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2已禁止" + args[1]);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2已禁止点歌" + args[1]);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2请输入有效的ID");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2请输入有效的ID");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (PlayMusic.nowPlayMusic != null) {
|
||||
list.add(PlayMusic.nowPlayMusic.getID());
|
||||
}
|
||||
for (SongInfoObj item : PlayMusic.getList()) {
|
||||
list.add(item.getID());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,28 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.utils.Function;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CommandBanPlayer implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
if (Function.isInteger(args[1])) {
|
||||
AllMusic.getConfig().addBanPlayer(args[1].toLowerCase(Locale.ROOT));
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2已禁止" + args[1]);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2请输入有效的ID");
|
||||
AllMusic.getConfig().addBanPlayer(args[1].toLowerCase(Locale.ROOT));
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2已禁止玩家" + args[1] + "点歌");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||
return AllMusic.side.getPlayerList();
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandCancel implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length == 1) {
|
||||
SongInfoObj id = PlayMusic.findPlayerMusic(name);
|
||||
if (id == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cancel.err1);
|
||||
return;
|
||||
}
|
||||
if (!id.getCall().equalsIgnoreCase(name)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cancel.err2.replace("%MusicName%", id.getName())
|
||||
.replace("%MusicAuthor%", id.getAuthor()));
|
||||
return;
|
||||
}
|
||||
PlayMusic.remove(id);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cancel.done);
|
||||
} else if (args.length == 2) {
|
||||
try {
|
||||
int index = Integer.parseInt(args[1]);
|
||||
SongInfoObj id = PlayMusic.findMusicIndex(index);
|
||||
if (id == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cancel.err3);
|
||||
return;
|
||||
}
|
||||
if (!id.getCall().equalsIgnoreCase(name)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cancel.err2.replace("%MusicName%", id.getName())
|
||||
.replace("%MusicAuthor%", id.getAuthor()));
|
||||
return;
|
||||
}
|
||||
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cancel.done);
|
||||
} catch (Exception e) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cancel.err4);
|
||||
}
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||
List<String> list = new ArrayList<>();
|
||||
List<SongInfoObj> list1 = PlayMusic.getList();
|
||||
if (list1.size() > 1) {
|
||||
for (int a = 1; a < list1.size(); a++) {
|
||||
SongInfoObj item = list1.get(a);
|
||||
if (item.getCall().equalsIgnoreCase(name)) {
|
||||
list.add(String.valueOf(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
|
||||
public class CommandClearList implements ICommand {
|
||||
public class CommandClearList extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
AllMusic.getConfig().PlayList.clear();
|
||||
AllMusic.saveConfig();
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2添加空闲音乐列表已清空");
|
||||
PlayMusic.clearIdleList();
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2添加空闲音乐列表已清空");
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,13 @@ package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
public class CommandCode implements ICommand {
|
||||
public class CommandCode extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
AllMusic.getMusicApi().sendCode(sender);
|
||||
if (args.length != 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
AllMusic.getMusicApi().sendCode(sender, args[1]);
|
||||
}
|
||||
}
|
||||
@@ -4,27 +4,44 @@ import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.utils.Function;
|
||||
|
||||
public class CommandDelete implements ICommand {
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandDelete extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
if (!args[1].isEmpty() && Function.isInteger(args[1])) {
|
||||
int music = Integer.parseInt(args[1]);
|
||||
if (music == 0) {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2请输入有效的序列ID");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2请输入有效的序列ID");
|
||||
return;
|
||||
}
|
||||
if (music > PlayMusic.getSize()) {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2序列号过大");
|
||||
if (music > PlayMusic.getListSize()) {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2序列号过大");
|
||||
return;
|
||||
}
|
||||
PlayMusic.remove(music - 1);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2已删除序列" + music);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2已删除序列" + music);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2请输入有效的序列ID");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2请输入有效的序列ID");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int a = 0; a < PlayMusic.getListSize(); a++) {
|
||||
list.add(String.valueOf(a + 1));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
+136
-56
@@ -8,36 +8,40 @@ import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
import coloryr.allmusic.core.objs.music.SearchPageObj;
|
||||
import coloryr.allmusic.core.utils.Function;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CommandEX {
|
||||
|
||||
private static final Map<String, ICommand> CommandList = new HashMap<>();
|
||||
private static final Map<String, ICommand> CommandAdminList = new HashMap<>();
|
||||
public static final Map<String, ICommand> commandList = new HashMap<>();
|
||||
public static final Map<String, ICommand> commandAdminList = new HashMap<>();
|
||||
|
||||
static {
|
||||
CommandList.put("stop", new CommandStop());
|
||||
CommandList.put("help", new CommandHelp());
|
||||
CommandList.put("list", new CommandList());
|
||||
CommandList.put("vote", new CommandVote());
|
||||
CommandList.put("nomusic", new CommandNoMusic());
|
||||
CommandList.put("search", new CommandSearch());
|
||||
CommandList.put("select", new CommandSelect());
|
||||
CommandList.put("nextpage", new CommandNextPage());
|
||||
CommandList.put("lastpage", new CommandLastPage());
|
||||
CommandList.put("hud", new CommandHud());
|
||||
CommandList.put("reload", new CommandReload());
|
||||
commandList.put("stop", new CommandStop());
|
||||
commandList.put("help", new CommandHelp());
|
||||
commandList.put("list", new CommandList());
|
||||
commandList.put("vote", new CommandVote());
|
||||
commandList.put("mute", new CommandMute());
|
||||
commandList.put("search", new CommandSearch());
|
||||
commandList.put("select", new CommandSelect());
|
||||
commandList.put("nextpage", new CommandNextPage());
|
||||
commandList.put("lastpage", new CommandLastPage());
|
||||
commandList.put("hud", new CommandHud());
|
||||
commandList.put("reload", new CommandReload());
|
||||
commandList.put("push", new CommandPush());
|
||||
commandList.put("cancel", new CommandCancel());
|
||||
|
||||
CommandAdminList.put("next", new CommandNext());
|
||||
CommandAdminList.put("ban", new CommandBan());
|
||||
CommandAdminList.put("banplayer", new CommandBanPlayer());
|
||||
CommandAdminList.put("url", new CommandUrl());
|
||||
CommandAdminList.put("delete", new CommandDelete());
|
||||
CommandAdminList.put("addlist", new CommandAddList());
|
||||
CommandAdminList.put("clearlist", new CommandClearList());
|
||||
CommandAdminList.put("code", new CommandCode());
|
||||
CommandAdminList.put("login", new CommandLogin());
|
||||
commandAdminList.put("next", new CommandNext());
|
||||
commandAdminList.put("ban", new CommandBan());
|
||||
commandAdminList.put("banplayer", new CommandBanPlayer());
|
||||
commandAdminList.put("url", new CommandUrl());
|
||||
commandAdminList.put("delete", new CommandDelete());
|
||||
commandAdminList.put("addlist", new CommandAddList());
|
||||
commandAdminList.put("clearlist", new CommandClearList());
|
||||
commandAdminList.put("code", new CommandCode());
|
||||
commandAdminList.put("login", new CommandLogin());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +60,7 @@ public class CommandEX {
|
||||
obj.isDefault = isDefault;
|
||||
|
||||
if (AllMusic.side.onMusicAdd(sender, obj)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.Cancel);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,12 +76,12 @@ public class CommandEX {
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean checkMoney(Object sender, String name, int cost) {
|
||||
if (!AllMusic.getConfig().UseCost || AllMusic.economy == null) {
|
||||
if (!AllMusic.getConfig().useCost || AllMusic.economy == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AllMusic.economy.check(name, cost)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Cost.NoMoney);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cost.noMoney);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -93,7 +97,7 @@ public class CommandEX {
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean cost(Object sender, String name, int cost, String message) {
|
||||
if (!AllMusic.getConfig().UseCost || AllMusic.economy == null) {
|
||||
if (!AllMusic.getConfig().useCost || AllMusic.economy == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -102,7 +106,7 @@ public class CommandEX {
|
||||
.replace("%Cost%", "" + cost));
|
||||
return false;
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Cost.CostFail);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().cost.costFail);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -129,22 +133,22 @@ public class CommandEX {
|
||||
} else
|
||||
musicID = args[0];
|
||||
if (Function.isInteger(musicID)) {
|
||||
if (PlayMusic.getSize() >= AllMusic.getConfig().MaxList) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.ListFull);
|
||||
} else if (AllMusic.getConfig().BanMusic.contains(musicID)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.BanMusic);
|
||||
} else if (PlayMusic.isHave(musicID)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.ExistMusic);
|
||||
if (PlayMusic.getListSize() >= AllMusic.getConfig().maxPlayList) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.listFull);
|
||||
} else if (AllMusic.getConfig().banMusic.contains(musicID)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.banMusic);
|
||||
} else if (PlayMusic.haveMusic(musicID)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.existMusic);
|
||||
} else if (PlayMusic.havePlayer(name)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.PlayerToMany);
|
||||
} else if (AllMusic.getConfig().BanPlayer.contains(name)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.PlayerBan);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.playerToMany);
|
||||
} else if (AllMusic.getConfig().banPlayer.contains(name)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.playerBan);
|
||||
} else {
|
||||
if (checkMoney(sender, name, AllMusic.getConfig().AddMusicCost)) {
|
||||
if (checkMoney(sender, name, AllMusic.getConfig().addMusicCost)) {
|
||||
return;
|
||||
}
|
||||
if (cost(sender, name, AllMusic.getConfig().AddMusicCost,
|
||||
AllMusic.getMessage().Cost.AddMusic)) {
|
||||
if (cost(sender, name, AllMusic.getConfig().addMusicCost,
|
||||
AllMusic.getMessage().cost.addMusic)) {
|
||||
return;
|
||||
}
|
||||
AllMusic.getConfig().RemoveNoMusicPlayer(name);
|
||||
@@ -156,17 +160,17 @@ public class CommandEX {
|
||||
obj.isDefault = false;
|
||||
|
||||
if (AllMusic.side.onMusicAdd(sender, obj)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.Cancel);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayMusic.addTask(obj);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.Success);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.success);
|
||||
} else
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.NoPlayer);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.noPlayer);
|
||||
}
|
||||
} else
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.NoID);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.noID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,22 +185,22 @@ public class CommandEX {
|
||||
String info;
|
||||
AllMusic.side.sendMessage(sender, "");
|
||||
if (search.haveLastPage()) {
|
||||
AllMusic.side.sendMessageRun(sender, "§d[AllMusic]§2输入/music lastpage上一页",
|
||||
AllMusic.getMessage().Page.Last, "/music lastpage");
|
||||
AllMusic.side.sendMessageRun(sender, "§d[AllMusic3]§2输入/music lastpage上一页",
|
||||
AllMusic.getMessage().page.last, "/music lastpage");
|
||||
}
|
||||
for (int a = 0; a < index; a++) {
|
||||
item = search.getRes(a + search.getPage() * 10);
|
||||
info = AllMusic.getMessage().Page.Choice;
|
||||
info = AllMusic.getMessage().page.choice;
|
||||
info = info.replace("%Index%", "" + (a + 1))
|
||||
.replace("%MusicName%", item.name)
|
||||
.replace("%MusicAuthor%", item.author)
|
||||
.replace("%MusicAl%", item.al);
|
||||
AllMusic.side.sendMessageRun(sender, info,
|
||||
AllMusic.getMessage().Click.This, "/music select " + (a + 1));
|
||||
AllMusic.getMessage().click.clickRun, "/music select " + (a + 1));
|
||||
}
|
||||
if (search.haveNextPage()) {
|
||||
AllMusic.side.sendMessageRun(sender, "§d[AllMusic]§2输入/music nextpage下一页",
|
||||
AllMusic.getMessage().Page.Next, "/music nextpage");
|
||||
AllMusic.side.sendMessageRun(sender, "§d[AllMusic3]§2输入/music nextpage下一页",
|
||||
AllMusic.getMessage().page.next, "/music nextpage");
|
||||
}
|
||||
AllMusic.side.sendMessage(sender, "");
|
||||
}
|
||||
@@ -210,27 +214,27 @@ public class CommandEX {
|
||||
*/
|
||||
public static void ex(Object sender, String name, String[] args) {
|
||||
if (args.length == 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
ICommand command = CommandList.get(args[0]);
|
||||
ICommand command = commandList.get(args[0]);
|
||||
if (command != null) {
|
||||
command.ex(sender, name, args);
|
||||
return;
|
||||
}
|
||||
|
||||
if (AllMusic.getConfig().Admin.stream().anyMatch(name::equalsIgnoreCase)) {
|
||||
command = CommandAdminList.get(args[0]);
|
||||
if (AllMusic.getConfig().adminList.stream().anyMatch(name::equalsIgnoreCase)) {
|
||||
command = commandAdminList.get(args[0]);
|
||||
if (command != null) {
|
||||
command.ex(sender, name, args);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (AllMusic.getConfig().NeedPermission &&
|
||||
if (AllMusic.getConfig().needPermission &&
|
||||
AllMusic.side.checkPermission(name, "allmusic.addmusic"))
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.NoPer);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.noPer);
|
||||
else {
|
||||
switch (AllMusic.getConfig().DefaultAddMusic) {
|
||||
switch (AllMusic.getConfig().defaultAddMusic) {
|
||||
case 1:
|
||||
searchMusic(sender, name, args, true);
|
||||
break;
|
||||
@@ -240,4 +244,80 @@ public class CommandEX {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<String> normal = new ArrayList<String>() {{
|
||||
this.add("stop");
|
||||
this.add("cancel");
|
||||
this.add("list");
|
||||
this.add("vote");
|
||||
this.add("mute");
|
||||
this.add("search");
|
||||
this.add("hud");
|
||||
this.add("push");
|
||||
}};
|
||||
|
||||
/**
|
||||
* 管理员的指令
|
||||
*/
|
||||
private static final List<String> admin = new ArrayList<String>() {{
|
||||
this.add("reload");
|
||||
this.add("next");
|
||||
this.add("ban");
|
||||
this.add("delete");
|
||||
this.add("addlist");
|
||||
this.add("clearlist");
|
||||
this.add("login");
|
||||
}};
|
||||
|
||||
/**
|
||||
* 搜歌的指令
|
||||
*/
|
||||
private static final List<String> search = new ArrayList<String>() {{
|
||||
this.add("select");
|
||||
this.add("nextpage");
|
||||
this.add("lastpage");
|
||||
}};
|
||||
|
||||
/**
|
||||
* 获取Tab指令列表
|
||||
*
|
||||
* @param name 用户名
|
||||
* @param arg 参数
|
||||
* @return 指令列表
|
||||
*/
|
||||
public static List<String> getTabList(String name, String[] arg) {
|
||||
List<String> arguments = new ArrayList<>();
|
||||
if (arg.length == 0) {
|
||||
arguments.addAll(normal);
|
||||
if (AllMusic.getConfig().adminList.contains(name)) {
|
||||
arguments.addAll(admin);
|
||||
}
|
||||
if (AllMusic.getSearch(name) != null) {
|
||||
return search;
|
||||
}
|
||||
} else if (arg.length == 1) {
|
||||
if (arg[0].isEmpty()) {
|
||||
arguments.addAll(normal);
|
||||
if (AllMusic.getConfig().adminList.contains(name)) {
|
||||
arguments.addAll(admin);
|
||||
}
|
||||
if (arg[0].isEmpty()) {
|
||||
if (AllMusic.getSearch(name) != null) {
|
||||
return search;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ICommand command = CommandEX.commandList.get(arg[0]);
|
||||
if (command != null) {
|
||||
arguments.addAll(command.tab(name, arg));
|
||||
}
|
||||
command = CommandEX.commandAdminList.get(arg[0]);
|
||||
if (command != null) {
|
||||
arguments.addAll(command.tab(name, arg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return arguments;
|
||||
}
|
||||
}
|
||||
@@ -2,55 +2,73 @@ package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
public class CommandHelp implements ICommand {
|
||||
public class CommandHelp extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Help.Normal.Head);
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Base,
|
||||
AllMusic.getMessage().Click.Check, "/music ");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Normal.Stop,
|
||||
AllMusic.getMessage().Click.This, "/music stop");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Normal.List,
|
||||
AllMusic.getMessage().Click.This, "/music list");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Normal.Vote,
|
||||
AllMusic.getMessage().Click.This, "/music vote");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Normal.NoMusic,
|
||||
AllMusic.getMessage().Click.This, "/music nomusic");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Search,
|
||||
AllMusic.getMessage().Click.Check, "/music search ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Select,
|
||||
AllMusic.getMessage().Click.Check, "/music select ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Hud1,
|
||||
AllMusic.getMessage().Click.Check, "/music hud enable ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Hud2,
|
||||
AllMusic.getMessage().Click.Check, "/music hud ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Hud3,
|
||||
AllMusic.getMessage().Click.Check, "/music hud picsize ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Hud4,
|
||||
AllMusic.getMessage().Click.Check, "/music hud picrotate ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Normal.Hud5,
|
||||
AllMusic.getMessage().Click.Check, "/music hud picrotatespeed ");
|
||||
if (AllMusic.getConfig().Admin.contains(name)) {
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Admin.Reload,
|
||||
AllMusic.getMessage().Click.This, "/music reload");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Admin.Next,
|
||||
AllMusic.getMessage().Click.This, "/music next");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Admin.Ban,
|
||||
AllMusic.getMessage().Click.Check, "/music ban ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Admin.BanPlayer,
|
||||
AllMusic.getMessage().Click.Check, "/music banplayer ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Admin.Url,
|
||||
AllMusic.getMessage().Click.Check, "/music url ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Admin.Delete,
|
||||
AllMusic.getMessage().Click.Check, "/music delete ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().Help.Admin.AddList,
|
||||
AllMusic.getMessage().Click.Check, "/music addlist ");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Admin.ClearList,
|
||||
AllMusic.getMessage().Click.This, "/music clearlist");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Admin.Login,
|
||||
AllMusic.getMessage().Click.Check, "/music login ");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().Help.Admin.Code,
|
||||
AllMusic.getMessage().Click.This, "/music code");
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().help.normal.head);
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.base,
|
||||
AllMusic.getMessage().click.clickCheck, "/music ");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.stop,
|
||||
AllMusic.getMessage().click.clickRun, "/music stop");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.list,
|
||||
AllMusic.getMessage().click.clickRun, "/music list");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.cancel,
|
||||
AllMusic.getMessage().click.clickRun, "/music cancel");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.vote,
|
||||
AllMusic.getMessage().click.clickRun, "/music vote");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.vote1,
|
||||
AllMusic.getMessage().click.clickRun, "/music vote cancel");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.push,
|
||||
AllMusic.getMessage().click.clickRun, "/music push");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.push1,
|
||||
AllMusic.getMessage().click.clickRun, "/music push cancel");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.mute,
|
||||
AllMusic.getMessage().click.clickRun, "/music mute");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.search,
|
||||
AllMusic.getMessage().click.clickCheck, "/music search ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.select,
|
||||
AllMusic.getMessage().click.clickCheck, "/music select ");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.hud9,
|
||||
AllMusic.getMessage().click.clickRun, "/music hud enable");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.normal.hud10,
|
||||
AllMusic.getMessage().click.clickRun, "/music hud reset");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud1,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud2,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud6,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud7,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud8,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud3,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud pic size ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud4,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud pic rotate ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud5,
|
||||
AllMusic.getMessage().click.clickCheck, "/music hud pic speed ");
|
||||
if (AllMusic.getConfig().adminList.contains(name)) {
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.admin.reload,
|
||||
AllMusic.getMessage().click.clickRun, "/music reload");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.admin.next,
|
||||
AllMusic.getMessage().click.clickRun, "/music next");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.admin.ban,
|
||||
AllMusic.getMessage().click.clickCheck, "/music ban ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.admin.banPlayer,
|
||||
AllMusic.getMessage().click.clickCheck, "/music banplayer ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.admin.url,
|
||||
AllMusic.getMessage().click.clickCheck, "/music url ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.admin.delete,
|
||||
AllMusic.getMessage().click.clickCheck, "/music delete ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.admin.addList,
|
||||
AllMusic.getMessage().click.clickCheck, "/music addlist ");
|
||||
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.admin.clearList,
|
||||
AllMusic.getMessage().click.clickRun, "/music clearlist");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.admin.login,
|
||||
AllMusic.getMessage().click.clickCheck, "/music login ");
|
||||
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.admin.code,
|
||||
AllMusic.getMessage().click.clickCheck, "/music code ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +1,83 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.objs.hud.PosObj;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class CommandHud implements ICommand {
|
||||
private final Map<String, ICommand> CommandList = new HashMap<>();
|
||||
public class CommandHud extends ACommand {
|
||||
private final Map<String, ICommand> commandList = new HashMap<>();
|
||||
|
||||
public CommandHud() {
|
||||
CommandList.put("enable", new HudEnable());
|
||||
CommandList.put("reset", new Reset());
|
||||
CommandList.put("picsize", new PicSize());
|
||||
CommandList.put("picrotate", new PicRotate());
|
||||
CommandList.put("picrotatespeed", new PicRotateSpeed());
|
||||
commandList.put("enable", new HudEnable());
|
||||
commandList.put("reset", new HudReset());
|
||||
commandList.put("info", new CommandHudSet(HudType.INFO));
|
||||
commandList.put("list", new CommandHudSet(HudType.LIST));
|
||||
commandList.put("lyric", new CommandHudSet(HudType.LYRIC));
|
||||
commandList.put("pic", new CommandHudSet(HudType.PIC));
|
||||
}
|
||||
|
||||
private static class HudEnable implements ICommand {
|
||||
public static class HudEnable implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length == 3) {
|
||||
try {
|
||||
String pos = args[2].toLowerCase(Locale.ROOT);
|
||||
boolean temp = HudUtils.setHudEnable(name, pos);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Hud.State
|
||||
.replace("%State%", temp ? "启用" : "关闭")
|
||||
.replace("%Hud%", AllMusic.getMessage().HudList.Get(pos)));
|
||||
} catch (Exception e) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
}
|
||||
} else {
|
||||
boolean temp = HudUtils.setHudEnable(name, null);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Hud.State
|
||||
.replace("%State%", temp ? "启用" : "关闭")
|
||||
.replace("%Hud%", AllMusic.getMessage().HudList.All));
|
||||
}
|
||||
boolean temp = HudUtils.setHudEnable(name, null);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.state
|
||||
.replace("%State%", temp ? "启用" : "关闭")
|
||||
.replace("%Hud%", AllMusic.getMessage().hudList.getHud(null)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Reset implements ICommand {
|
||||
public static class HudReset implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
HudUtils.reset(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Hud.Reset);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.reset
|
||||
.replace("%Hud%", AllMusic.getMessage().hudList.getHud(null)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PicSize implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 3 || !HudUtils.setPicSize(name, args[2])) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender,
|
||||
AllMusic.getMessage().Hud.PicSize.replace("%Size%", args[2]));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PicRotate implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 3) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Hud.PicRotate
|
||||
.replace("%State%", String.valueOf(HudUtils.setPicRotate(name, args[2]))));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PicRotateSpeed implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 3 || !HudUtils.setPicRotateSpeed(name, args[2])) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender,
|
||||
AllMusic.getMessage().Hud.PicRotateSpeed.replace("%Size%", args[2]));
|
||||
public List<String> tab(String name, String[] args) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length == 1) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
} else {
|
||||
ICommand command = CommandList.get(args[1]);
|
||||
ICommand command = commandList.get(args[1]);
|
||||
if (command != null) {
|
||||
command.ex(sender, name, args);
|
||||
} else if (args.length != 4) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
} else {
|
||||
try {
|
||||
PosObj obj = HudUtils.setHudPos(name, args[1], args[2], args[3]);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
} else {
|
||||
String temp = AllMusic.getMessage().Hud.Set
|
||||
.replace("%Hud%", args[1])
|
||||
.replace("%x%", args[2])
|
||||
.replace("%y%", args[3]);
|
||||
AllMusic.side.sendMessage(sender, temp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
}
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hud的指令
|
||||
*/
|
||||
private static final List<String> hudlist = new ArrayList<String>() {{
|
||||
this.add("enable");
|
||||
this.add("reset");
|
||||
this.add("info");
|
||||
this.add("list");
|
||||
this.add("lyric");
|
||||
this.add("pic");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||
return hudlist;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.objs.enums.HudDirType;
|
||||
import coloryr.allmusic.core.objs.hud.PosObj;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CommandHudSet extends AHudCommand {
|
||||
private final Map<String, ICommand> commandList = new HashMap<>();
|
||||
|
||||
public CommandHudSet(HudType type) {
|
||||
super(type);
|
||||
commandList.put("enable", new HudEnable(type));
|
||||
commandList.put("reset", new HudReset(type));
|
||||
commandList.put("pos", new HudPos(type));
|
||||
commandList.put("dir", new HudDir(type));
|
||||
if (type == HudType.PIC) {
|
||||
commandList.put("size", new PicSize());
|
||||
commandList.put("rotate", new PicRotate());
|
||||
commandList.put("speed", new PicRotateSpeed());
|
||||
} else {
|
||||
commandList.put("color", new HudColor(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class HudEnable extends AHudCommand {
|
||||
public HudEnable(HudType type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
boolean temp = HudUtils.setHudEnable(name, type);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.state
|
||||
.replace("%State%", temp
|
||||
? AllMusic.getMessage().hudList.enable
|
||||
: AllMusic.getMessage().hudList.disable)
|
||||
.replace("%Hud%", AllMusic.getMessage().hudList.all));
|
||||
}
|
||||
}
|
||||
|
||||
private static class HudReset extends AHudCommand {
|
||||
public HudReset(HudType type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
HudUtils.reset(name, type);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.reset
|
||||
.replace("%Hud%", AllMusic.getMessage().hudList.getHud(type)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class HudPos extends AHudCommand {
|
||||
public HudPos(HudType type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
try {
|
||||
if (args.length != 5) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
PosObj obj = HudUtils.setHudPos(name, type, args[3], args[4]);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.set
|
||||
.replace("%Hud%", AllMusic.getMessage().hudList.getHud(type))
|
||||
.replace("%x%", args[3])
|
||||
.replace("%y%", args[4]));
|
||||
} catch (Exception e) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class HudDir extends AHudCommand {
|
||||
public HudDir(HudType type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 4) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
HudDirType type1 = HudUtils.setDir(name, type, args[3]);
|
||||
if (type1 == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.set1
|
||||
.replace("%Hud%", AllMusic.getMessage().hudList.getHud(type))
|
||||
.replace("%Dir%", AllMusic.getMessage().hudList.getDir(type1)));
|
||||
}
|
||||
|
||||
private static final List<String> dir = new ArrayList<String>() {{
|
||||
for (HudDirType type : HudDirType.values()) {
|
||||
this.add(type.name());
|
||||
}
|
||||
}};
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 3 || (args.length == 4 && args[3].isEmpty())) {
|
||||
return dir;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
private static class HudColor extends AHudCommand {
|
||||
public HudColor(HudType type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (!HudUtils.setColor(name, type, args[3])) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.set2
|
||||
.replace("%Hud%", AllMusic.getMessage().hudList.getHud(type))
|
||||
.replace("%Color%", args[3]));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PicSize implements ICommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 3 || !HudUtils.setPicSize(name, args[2])) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender,
|
||||
AllMusic.getMessage().hud.picSize.replace("%Size%", args[2]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
private static class PicRotate extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 4) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.picRotate
|
||||
.replace("%State%", HudUtils.setPicRotate(name, args[3])
|
||||
? AllMusic.getMessage().hudList.enable
|
||||
: AllMusic.getMessage().hudList.disable));
|
||||
}
|
||||
}
|
||||
|
||||
private static class PicRotateSpeed extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 4 || !HudUtils.setPicRotateSpeed(name, args[3])) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender,
|
||||
AllMusic.getMessage().hud.picSpeed.replace("%Size%", args[2]));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length == 1) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
} else {
|
||||
ICommand command = commandList.get(args[2]);
|
||||
if (command != null) {
|
||||
command.ex(sender, name, args);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hud的指令
|
||||
*/
|
||||
private static final List<String> hud = new ArrayList<String>() {{
|
||||
this.add("enable");
|
||||
this.add("pos");
|
||||
this.add("dir");
|
||||
this.add("reset");
|
||||
}};
|
||||
|
||||
private static final List<String> pic = new ArrayList<String>() {{
|
||||
this.add("size");
|
||||
this.add("rotate");
|
||||
this.add("speed");
|
||||
}};
|
||||
|
||||
private static final List<String> info = new ArrayList<String>() {{
|
||||
this.add("color");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 2 || (args.length == 3 && args[2].isEmpty())) {
|
||||
List<String> list = new ArrayList<>(hud);
|
||||
if (type == HudType.PIC) {
|
||||
list.addAll(pic);
|
||||
} else {
|
||||
list.addAll(info);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,21 @@ package coloryr.allmusic.core.command;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.objs.music.SearchPageObj;
|
||||
|
||||
public class CommandLastPage implements ICommand {
|
||||
public class CommandLastPage extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (AllMusic.getConfig().NeedPermission &&
|
||||
if (AllMusic.getConfig().needPermission &&
|
||||
AllMusic.side.checkPermission(name, "allmusic.search")) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoPer);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.noPer);
|
||||
return;
|
||||
}
|
||||
SearchPageObj obj = AllMusic.getSearch(name);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoSearch);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.emptySearch);
|
||||
} else if (obj.lastPage()) {
|
||||
CommandEX.showSearch(sender, obj);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.CantLast);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.cantLast);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,13 @@ package coloryr.allmusic.core.command;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
|
||||
public class CommandList implements ICommand {
|
||||
public class CommandList extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (PlayMusic.nowPlayMusic == null || PlayMusic.nowPlayMusic.isNull()) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().MusicPlay.NoMusic);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().musicPlay.emptyPlayingMusic);
|
||||
} else {
|
||||
String info = AllMusic.getMessage().MusicPlay.Play;
|
||||
String info = AllMusic.getMessage().musicPlay.nowPlay;
|
||||
info = info.replace("%MusicName%", PlayMusic.nowPlayMusic.getName())
|
||||
.replace("%MusicAuthor%", PlayMusic.nowPlayMusic.getAuthor())
|
||||
.replace("%MusicAl%", PlayMusic.nowPlayMusic.getAl())
|
||||
@@ -17,11 +17,11 @@ public class CommandList implements ICommand {
|
||||
.replace("%PlayerName%", PlayMusic.nowPlayMusic.getCall());
|
||||
AllMusic.side.sendMessage(sender, info);
|
||||
}
|
||||
if (PlayMusic.getSize() == 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().MusicPlay.NoPlay);
|
||||
if (PlayMusic.getListSize() == 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().musicPlay.emptyPlay);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().MusicPlay.ListMusic.Head
|
||||
.replace("%Count%", "" + PlayMusic.getSize()));
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().musicPlay.listMusic.head
|
||||
.replace("%Count%", "" + PlayMusic.getListSize()));
|
||||
AllMusic.side.sendMessage(sender, PlayMusic.getAllList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
public class CommandLogin implements ICommand {
|
||||
public class CommandLogin extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 2) {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§c没有手机验证码");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§c没有手机验证码");
|
||||
return;
|
||||
}
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§d重新登录网易云账户");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§d登录网易云账户");
|
||||
AllMusic.getMusicApi().login(sender, args[1]);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
public class CommandNoMusic implements ICommand {
|
||||
public class CommandMute extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
AllMusic.side.sendStop(name);
|
||||
AllMusic.side.clearHud(name);
|
||||
AllMusic.getConfig().AddNoMusicPlayer(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().MusicPlay.NoPlayMusic);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().musicPlay.mute);
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,12 @@ package coloryr.allmusic.core.command;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
|
||||
public class CommandNext implements ICommand {
|
||||
public class CommandNext extends ACommand {
|
||||
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
PlayMusic.musicLessTime = 1;
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2已强制切歌");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2已强制切歌");
|
||||
AllMusic.getConfig().RemoveNoMusicPlayer(name);
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,21 @@ package coloryr.allmusic.core.command;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.objs.music.SearchPageObj;
|
||||
|
||||
public class CommandNextPage implements ICommand {
|
||||
public class CommandNextPage extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (AllMusic.getConfig().NeedPermission &&
|
||||
if (AllMusic.getConfig().needPermission &&
|
||||
AllMusic.side.checkPermission(name, "allmusic.search")) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoPer);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.noPer);
|
||||
return;
|
||||
}
|
||||
SearchPageObj obj = AllMusic.getSearch(name);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoSearch);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.emptySearch);
|
||||
} else if (obj.nextPage()) {
|
||||
CommandEX.showSearch(sender, obj);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.CantNext);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.cantNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandPush extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (AllMusic.getConfig().needPermission &&
|
||||
AllMusic.side.checkPermission(name, "allmusic.push")) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.noPermission);
|
||||
return;
|
||||
}
|
||||
if (PlayMusic.getListSize() == 0 && PlayMusic.getIdleListSize() == 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().musicPlay.emptyPlay);
|
||||
}
|
||||
SongInfoObj id = null;
|
||||
if (args.length == 1) {
|
||||
id = PlayMusic.findPlayerMusic(name);
|
||||
if (id == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.noId);
|
||||
return;
|
||||
}
|
||||
SongInfoObj id1 = PlayMusic.findMusicIndex(1);
|
||||
if (id1 != null && id1.getID().equalsIgnoreCase(id.getID())) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.pushErr);
|
||||
return;
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
if (args[1].equalsIgnoreCase("cancel")) {
|
||||
if (!PlayMusic.pushSender.equalsIgnoreCase(name)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.err1);
|
||||
return;
|
||||
}
|
||||
if (PlayMusic.pushTime <= 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.err2);
|
||||
return;
|
||||
}
|
||||
PlayMusic.pushTime = -1;
|
||||
AllMusic.clearPush();
|
||||
AllMusic.side.bq(AllMusic.getMessage().push.cancel);
|
||||
PlayMusic.pushSender = null;
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
int index = Integer.parseInt(args[1]);
|
||||
id = PlayMusic.findMusicIndex(index);
|
||||
} catch (Exception e) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.noId);
|
||||
return;
|
||||
}
|
||||
if (id == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.noId1.replace("%Index%", args[1]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (args.length > 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
if (PlayMusic.pushTime <= 0) {
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
PlayMusic.pushTime = AllMusic.getConfig().voteTime;
|
||||
PlayMusic.push = id;
|
||||
AllMusic.addPush(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.doVote);
|
||||
String data = AllMusic.getMessage().push.bq;
|
||||
AllMusic.side.bq(data
|
||||
.replace("%PlayerName%", name)
|
||||
.replace("%Time%", String.valueOf(AllMusic.getConfig().voteTime))
|
||||
.replace("%MusicName%", id.getName())
|
||||
.replace("%MusicAuthor%", id.getAuthor()));
|
||||
AllMusic.side.bqRun(AllMusic.getMessage().push.bq1, AllMusic.getMessage().push.bq2, "/music push");
|
||||
} else {
|
||||
if (id != null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.err3);
|
||||
return;
|
||||
}
|
||||
if (!AllMusic.containVote(name)) {
|
||||
AllMusic.addPush(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.agree);
|
||||
String data = AllMusic.getMessage().push.bqAgree;
|
||||
data = data.replace("%PlayerName%", name)
|
||||
.replace("%Count%", "" + AllMusic.getVoteCount());
|
||||
AllMusic.side.bq(data);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.arAgree);
|
||||
}
|
||||
}
|
||||
AllMusic.getConfig().RemoveNoMusicPlayer(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||
List<String> list = new ArrayList<>();
|
||||
List<SongInfoObj> list1 = PlayMusic.getList();
|
||||
for (int a = 1; a < list1.size(); a++) {
|
||||
SongInfoObj item = list1.get(a);
|
||||
if (item.getCall().equalsIgnoreCase(name)) {
|
||||
list.add(String.valueOf(a));
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
public class CommandReload implements ICommand {
|
||||
public class CommandReload extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
AllMusic.side.reload();
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§2已重读配置文件");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2已重读配置文件");
|
||||
}
|
||||
}
|
||||
@@ -2,23 +2,23 @@ package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
public class CommandSearch implements ICommand {
|
||||
public class CommandSearch extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (AllMusic.getConfig().NeedPermission &&
|
||||
if (AllMusic.getConfig().needPermission &&
|
||||
AllMusic.side.checkPermission(name, "allmusic.search")) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoPer);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.noPer);
|
||||
return;
|
||||
}
|
||||
if (CommandEX.checkMoney(sender, name, AllMusic.getConfig().SearchCost)) {
|
||||
if (CommandEX.checkMoney(sender, name, AllMusic.getConfig().searchCost)) {
|
||||
return;
|
||||
}
|
||||
if (CommandEX.cost(sender, name, AllMusic.getConfig().SearchCost,
|
||||
AllMusic.getMessage().Cost.Search)) {
|
||||
if (CommandEX.cost(sender, name, AllMusic.getConfig().searchCost,
|
||||
AllMusic.getMessage().cost.search)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.StartSearch);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.startSearch);
|
||||
CommandEX.searchMusic(sender, name, args, false);
|
||||
}
|
||||
}
|
||||
@@ -4,31 +4,50 @@ import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.objs.music.SearchPageObj;
|
||||
import coloryr.allmusic.core.utils.Function;
|
||||
|
||||
public class CommandSelect implements ICommand {
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandSelect extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (AllMusic.getConfig().NeedPermission &&
|
||||
if (AllMusic.getConfig().needPermission &&
|
||||
AllMusic.side.checkPermission(name, "allmusic.search")) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoPer);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.noPer);
|
||||
return;
|
||||
}
|
||||
SearchPageObj obj = AllMusic.getSearch(name);
|
||||
if (obj == null) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.NoSearch);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.emptySearch);
|
||||
} else if (!args[1].isEmpty() && Function.isInteger(args[1])) {
|
||||
int a = Integer.parseInt(args[1]);
|
||||
if (a == 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.ErrorNum);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.errorNum);
|
||||
return;
|
||||
}
|
||||
String[] ID = new String[1];
|
||||
ID[0] = obj.getSong((obj.getPage() * 10) + (a - 1));
|
||||
AllMusic.side.sendMessage(sender,
|
||||
AllMusic.getMessage().Search.Chose.replace("%Num%", "" + a));
|
||||
AllMusic.getMessage().search.choice.replace("%Num%", "" + a));
|
||||
CommandEX.addMusic(sender, name, ID);
|
||||
AllMusic.removeSearch(name);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Search.ErrorNum);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().search.errorNum);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tab(String name, String[] args) {
|
||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||
List<String> list = new ArrayList<>();
|
||||
SearchPageObj obj = AllMusic.getSearch(name);
|
||||
if (obj != null) {
|
||||
for (int a = 0; a < obj.getIndex(); a++) {
|
||||
list.add(String.valueOf(a));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
|
||||
public class CommandStop implements ICommand {
|
||||
public class CommandStop extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
AllMusic.side.clearHud(name);
|
||||
AllMusic.side.sendStop(name);
|
||||
HudUtils.clearHud(name);
|
||||
AllMusic.removeNowPlayPlayer(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().MusicPlay.StopPlay);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().musicPlay.stopPlaying);
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,11 @@ import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
|
||||
public class CommandUrl implements ICommand {
|
||||
public class CommandUrl extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (args.length != 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Command.Error);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
}
|
||||
MusicObj obj = new MusicObj();
|
||||
@@ -16,6 +16,6 @@ public class CommandUrl implements ICommand {
|
||||
obj.isUrl = true;
|
||||
obj.url = args[1];
|
||||
PlayMusic.addTask(obj);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().AddMusic.Success);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().addMusic.success);
|
||||
}
|
||||
}
|
||||
@@ -3,33 +3,53 @@ package coloryr.allmusic.core.command;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
|
||||
public class CommandVote implements ICommand {
|
||||
public class CommandVote extends ACommand {
|
||||
@Override
|
||||
public void ex(Object sender, String name, String[] args) {
|
||||
if (AllMusic.getConfig().NeedPermission &&
|
||||
if (AllMusic.getConfig().needPermission &&
|
||||
AllMusic.side.checkPermission(name, "allmusic.vote")) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Vote.NoPermission);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.noPermission);
|
||||
return;
|
||||
}
|
||||
if (PlayMusic.getSize() == 0 && AllMusic.getConfig().PlayList.size() == 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().MusicPlay.NoPlay);
|
||||
} else if (PlayMusic.voteTime == 0) {
|
||||
PlayMusic.voteTime = AllMusic.getConfig().VoteTime;
|
||||
} else if (PlayMusic.getListSize() == 0 && PlayMusic.getIdleListSize() == 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().musicPlay.emptyPlay);
|
||||
} else if (args.length == 2) {
|
||||
if (args[1].equalsIgnoreCase("cancel")) {
|
||||
if (!PlayMusic.voteSender.equalsIgnoreCase(name)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.err1);
|
||||
return;
|
||||
} else if (PlayMusic.voteTime <= 0) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.err2);
|
||||
return;
|
||||
}
|
||||
AllMusic.side.bq(AllMusic.getMessage().vote.cancel);
|
||||
PlayMusic.voteTime = -1;
|
||||
AllMusic.clearVote();
|
||||
PlayMusic.voteSender = null;
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
}
|
||||
return;
|
||||
} else if (args.length > 2) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
||||
return;
|
||||
} else if (PlayMusic.voteTime <= 0) {
|
||||
PlayMusic.voteTime = AllMusic.getConfig().voteTime;
|
||||
AllMusic.addVote(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Vote.DoVote);
|
||||
String data = AllMusic.getMessage().Vote.BQ;
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.doVote);
|
||||
String data = AllMusic.getMessage().vote.bq;
|
||||
AllMusic.side.bq(data.replace("%PlayerName%", name)
|
||||
.replace("%Time%", String.valueOf(AllMusic.getConfig().VoteTime)));
|
||||
} else if (PlayMusic.voteTime > 0) {
|
||||
.replace("%Time%", String.valueOf(AllMusic.getConfig().voteTime)));
|
||||
AllMusic.side.bqRun(AllMusic.getMessage().vote.bq1, AllMusic.getMessage().vote.bq2, "/music vote");
|
||||
} else {
|
||||
if (!AllMusic.containVote(name)) {
|
||||
AllMusic.addVote(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Vote.Agree);
|
||||
String data = AllMusic.getMessage().Vote.BQAgree;
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.agree);
|
||||
String data = AllMusic.getMessage().vote.bqAgree;
|
||||
data = data.replace("%PlayerName%", name)
|
||||
.replace("%Count%", "" + AllMusic.getVoteCount());
|
||||
AllMusic.side.bq(data);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().Vote.ARAgree);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.arAgree);
|
||||
}
|
||||
}
|
||||
AllMusic.getConfig().RemoveNoMusicPlayer(name);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICommand {
|
||||
void ex(Object sender, String name, String[] args);
|
||||
List<String> tab(String name, String[] args);
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package coloryr.allmusic.core.command;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TabCommand {
|
||||
/**
|
||||
* 个人的指令
|
||||
*/
|
||||
private static final List<String> normal = new ArrayList<String>() {{
|
||||
this.add("stop");
|
||||
this.add("list");
|
||||
this.add("vote");
|
||||
this.add("nomusic");
|
||||
this.add("search");
|
||||
this.add("hud");
|
||||
}};
|
||||
|
||||
/**
|
||||
* 搜歌的指令
|
||||
*/
|
||||
private static final List<String> search = new ArrayList<String>() {{
|
||||
this.add("select");
|
||||
this.add("nextpage");
|
||||
this.add("lastpage");
|
||||
}};
|
||||
|
||||
/**
|
||||
* 管理员的指令
|
||||
*/
|
||||
private static final List<String> admin = new ArrayList<String>() {{
|
||||
this.add("reload");
|
||||
this.add("next");
|
||||
this.add("ban");
|
||||
this.add("delete");
|
||||
this.add("addlist");
|
||||
this.add("clearlist");
|
||||
this.add("login");
|
||||
}};
|
||||
|
||||
/**
|
||||
* Hud的指令
|
||||
*/
|
||||
private static final List<String> hudlist = new ArrayList<String>() {{
|
||||
this.add("info");
|
||||
this.add("list");
|
||||
this.add("lyric");
|
||||
this.add("pic");
|
||||
}};
|
||||
|
||||
/**
|
||||
* Hud的指令
|
||||
*/
|
||||
private static final List<String> hud = new ArrayList<String>() {{
|
||||
this.add("info");
|
||||
this.add("list");
|
||||
this.add("lyric");
|
||||
this.add("pic");
|
||||
this.add("picsize");
|
||||
this.add("picrotate");
|
||||
this.add("picrotatespeed");
|
||||
this.add("enable");
|
||||
this.add("reset");
|
||||
}};
|
||||
|
||||
/**
|
||||
* 获取Tab指令列表
|
||||
*
|
||||
* @param name 用户名
|
||||
* @param arg 参数
|
||||
* @return 指令列表
|
||||
*/
|
||||
public static List<String> getTabList(String name, String[] arg) {
|
||||
List<String> arguments = new ArrayList<>();
|
||||
if (arg.length == 0 || arg.length == 1) {
|
||||
arguments.addAll(normal);
|
||||
if (AllMusic.getSearch(name) != null) {
|
||||
arguments.addAll(search);
|
||||
}
|
||||
if (AllMusic.getConfig().Admin.contains(name)) {
|
||||
arguments.addAll(admin);
|
||||
}
|
||||
} else if (arg.length == 2) {
|
||||
if ("hud".equalsIgnoreCase(arg[0]) &&
|
||||
"enable".equalsIgnoreCase(arg[1])) {
|
||||
arguments.addAll(hudlist);
|
||||
} else if ("hud".equalsIgnoreCase(arg[0])) {
|
||||
arguments.addAll(hud);
|
||||
}
|
||||
} else if (arg.length == 3) {
|
||||
if ("hud".equalsIgnoreCase(arg[0]) &&
|
||||
"enable".equalsIgnoreCase(arg[1])) {
|
||||
arguments.addAll(hudlist);
|
||||
}
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package coloryr.allmusic.core.enums;
|
||||
|
||||
public enum HudPos {
|
||||
info, list, lyric, pic
|
||||
}
|
||||
+43
-58
@@ -1,7 +1,8 @@
|
||||
package coloryr.allmusic.core.music.api;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.enums.EncryptType;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.enums.EncryptType;
|
||||
import coloryr.allmusic.core.music.play.LyricDo;
|
||||
import coloryr.allmusic.core.music.play.LyricSave;
|
||||
import coloryr.allmusic.core.objs.HttpResObj;
|
||||
@@ -21,37 +22,41 @@ import okhttp3.Cookie;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class APIMain {
|
||||
|
||||
public int PlayNow = 0;
|
||||
public boolean isUpdata;
|
||||
private boolean isUpdate;
|
||||
private String phone;
|
||||
|
||||
public APIMain() {
|
||||
AllMusic.log.info("§d[AllMusic]§e正在初始化网络爬虫");
|
||||
AllMusic.log.info("§d[AllMusic3]§e正在初始化网络爬虫");
|
||||
HttpClientUtil.init();
|
||||
HttpResObj res = HttpClientUtil.get("https://music.163.com", "");
|
||||
if (res == null || !res.ok) {
|
||||
AllMusic.log.info("§d[AllMusic]§c初始化网络爬虫连接失败");
|
||||
AllMusic.log.info("§d[AllMusic3]§c初始化网络爬虫连接失败");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isUpdate() {
|
||||
return isUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机验证码
|
||||
*
|
||||
* @param sender 发送者
|
||||
*/
|
||||
public void sendCode(Object sender) {
|
||||
public void sendCode(Object sender, String code) {
|
||||
phone = code;
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("ctcode", "86");
|
||||
params.addProperty("cellphone", AllMusic.getConfig().LoginUser);
|
||||
params.addProperty("cellphone", code);
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/api/sms/captcha/sent", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.ok) {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§d已发送验证码\n" + res.data);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§d已发送验证码\n" + res.data);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§c验证码发送失败");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§c验证码发送失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +67,13 @@ public class APIMain {
|
||||
* @param code 手机验证码
|
||||
*/
|
||||
public void login(Object sender, String code) {
|
||||
if(phone == null) {
|
||||
if (sender == null)
|
||||
AllMusic.log.info("§d[AllMusic3]§c没有发送过验证码");
|
||||
else
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§c没有发送过验证码");
|
||||
return;
|
||||
}
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("rememberLogin", "true");
|
||||
if (AllMusic.cookie.cookieStore.containsKey("music.163.com")) {
|
||||
@@ -86,26 +98,26 @@ public class APIMain {
|
||||
AllMusic.saveCookie();
|
||||
}
|
||||
params.addProperty("countrycode", "86");
|
||||
params.addProperty("phone", AllMusic.getConfig().LoginUser);
|
||||
params.addProperty("phone", phone);
|
||||
params.addProperty("captcha", code);
|
||||
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登录失败");
|
||||
AllMusic.log.info("§d[AllMusic3]§c登录失败");
|
||||
else
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§c登录失败");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§c登录失败");
|
||||
return;
|
||||
}
|
||||
if (res.data.contains("200")) {
|
||||
if (sender == null)
|
||||
AllMusic.log.info("§d[AllMusic]§d已登录");
|
||||
AllMusic.log.info("§d[AllMusic3]§d已登录");
|
||||
else
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§d已登录");
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§d已登录");
|
||||
} else {
|
||||
if (sender == null)
|
||||
AllMusic.log.info("§d[AllMusic]§c登录失败:账号或密码错误\n" + res.data);
|
||||
AllMusic.log.info("§d[AllMusic3]§c登录失败:账号或密码错误\n" + res.data);
|
||||
else
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic]§c登录失败:账号或密码错误\n" + res.data);
|
||||
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§c登录失败:账号或密码错误\n" + res.data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +142,7 @@ public class APIMain {
|
||||
params.addProperty("br", "320000");
|
||||
res = HttpClientUtil.post("https://music.163.com/weapi/song/enhance/player/url", params, EncryptType.WEAPI, null);
|
||||
if (res == null || !res.ok) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c版权检索失败");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c版权检索失败");
|
||||
return null;
|
||||
}
|
||||
TrialInfoObj obj = AllMusic.gson.fromJson(res.data, TrialInfoObj.class);
|
||||
@@ -164,7 +176,7 @@ public class APIMain {
|
||||
temp.getId(), temp.getAlia(), player, "电台", isList, temp.getLength(),
|
||||
null, false, null);
|
||||
} else {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲信息获取为空");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌曲信息获取为空");
|
||||
}
|
||||
}
|
||||
return info;
|
||||
@@ -179,7 +191,7 @@ public class APIMain {
|
||||
public String getPlayUrl(String id) {
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("ids", "[" + id + "]");
|
||||
params.addProperty("br", AllMusic.getConfig().MusicBR);
|
||||
params.addProperty("br", AllMusic.getConfig().musicBR);
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/weapi/song/enhance/player/url", params, EncryptType.WEAPI, null);
|
||||
if (res != null && res.ok) {
|
||||
try {
|
||||
@@ -187,7 +199,7 @@ public class APIMain {
|
||||
return obj.getUrl();
|
||||
} catch (Exception e) {
|
||||
Logs.logWrite(res.data);
|
||||
AllMusic.log.warning("§d[AllMusic]§c播放连接解析错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c播放连接解析错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -209,16 +221,15 @@ public class APIMain {
|
||||
HttpResObj res = HttpClientUtil.post("https://music.163.com/api/v6/playlist/detail", params, EncryptType.API, null);
|
||||
if (res != null && res.ok)
|
||||
try {
|
||||
isUpdata = true;
|
||||
isUpdate = true;
|
||||
DataObj obj = AllMusic.gson.fromJson(res.data, DataObj.class);
|
||||
AllMusic.getConfig().PlayList.addAll(obj.getPlaylist());
|
||||
AllMusic.saveConfig();
|
||||
AllMusic.side.sendMessaget(sender, AllMusic.getMessage().MusicPlay.ListMusic.Get.replace("%ListName%", obj.getName()));
|
||||
PlayMusic.addIdleList(obj.getPlaylist());
|
||||
AllMusic.side.sendMessaget(sender, AllMusic.getMessage().musicPlay.listMusic.get.replace("%ListName%", obj.getName()));
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲列表获取错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌曲列表获取错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
isUpdata = false;
|
||||
isUpdate = false;
|
||||
}, "AllMusic_setList");
|
||||
thread.start();
|
||||
}
|
||||
@@ -249,10 +260,10 @@ public class APIMain {
|
||||
LyricDo temp = new LyricDo();
|
||||
for (int times = 0; times < 3; times++) {
|
||||
if (temp.check(obj)) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词解析错误,正在进行第" + times + "重试");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌词解析错误,正在进行第" + times + "重试");
|
||||
} else {
|
||||
if (temp.isHave) {
|
||||
lyric.setHaveLyric(AllMusic.getConfig().SendLyric);
|
||||
lyric.setHaveLyric(AllMusic.getConfig().sendLyric);
|
||||
lyric.setLyric(temp.getTemp());
|
||||
if (temp.isHaveK) {
|
||||
lyric.setKlyric(temp.getKLyric());
|
||||
@@ -262,9 +273,9 @@ public class APIMain {
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词解析失败");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌词解析失败");
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词解析错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌词解析错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -308,36 +319,10 @@ public class APIMain {
|
||||
maxpage = res1.size() / 10;
|
||||
return new SearchPageObj(resData, maxpage);
|
||||
} else {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲搜索出现错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌曲搜索出现错误");
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取空闲歌单的一首歌
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public String getListMusic() {
|
||||
if (!isUpdata && !AllMusic.getConfig().PlayList.isEmpty()) {
|
||||
String ID;
|
||||
if (AllMusic.getConfig().PlayListRandom) {
|
||||
if (AllMusic.getConfig().PlayList.isEmpty())
|
||||
return null;
|
||||
else if (AllMusic.getConfig().PlayList.size() == 1)
|
||||
return AllMusic.getConfig().PlayList.get(0);
|
||||
ID = AllMusic.getConfig().PlayList.get(new Random().nextInt(AllMusic.getConfig().PlayList.size()));
|
||||
} else {
|
||||
ID = AllMusic.getConfig().PlayList.get(PlayNow);
|
||||
if (PlayNow == AllMusic.getConfig().PlayList.size() - 1)
|
||||
PlayNow = 0;
|
||||
else
|
||||
PlayNow++;
|
||||
}
|
||||
return ID;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package coloryr.allmusic.core.music.api;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.enums.EncryptType;
|
||||
import coloryr.allmusic.core.objs.enums.EncryptType;
|
||||
import coloryr.allmusic.core.objs.HttpResObj;
|
||||
import coloryr.allmusic.core.objs.api.EncResObj;
|
||||
import com.google.gson.JsonElement;
|
||||
@@ -50,7 +50,7 @@ public class HttpClientUtil {
|
||||
int httpCode = response.code();
|
||||
ResponseBody body = response.body();
|
||||
if (body == null) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c获取网页错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c获取网页错误");
|
||||
return null;
|
||||
}
|
||||
InputStream inputStream = body.byteStream();
|
||||
@@ -63,11 +63,11 @@ public class HttpClientUtil {
|
||||
}
|
||||
String data1 = result.toString(StandardCharsets.UTF_8.name());
|
||||
if (!ok) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c服务器返回错误:" + data1);
|
||||
AllMusic.log.warning("§d[AllMusic3]§c服务器返回错误:" + data1);
|
||||
}
|
||||
return new HttpResObj(data1, ok);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c获取网页错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c获取网页错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
@@ -146,7 +146,7 @@ public class HttpClientUtil {
|
||||
int httpCode = response.code();
|
||||
ResponseBody body = response.body();
|
||||
if (body == null) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c获取网页错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c获取网页错误");
|
||||
return null;
|
||||
}
|
||||
InputStream inputStream = body.byteStream();
|
||||
@@ -159,11 +159,11 @@ public class HttpClientUtil {
|
||||
}
|
||||
String data1 = result.toString(StandardCharsets.UTF_8.name());
|
||||
if (!ok) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c服务器返回错误:" + data1);
|
||||
AllMusic.log.warning("§d[AllMusic3]§c服务器返回错误:" + data1);
|
||||
}
|
||||
return new HttpResObj(data1, ok);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c获取网页错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c获取网页错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -114,8 +114,8 @@ public class LyricDo {
|
||||
milt /= 10;
|
||||
}
|
||||
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 * 10;
|
||||
if (time > 0 && time + AllMusic.getConfig().lyricDelay > 0)
|
||||
time += AllMusic.getConfig().lyricDelay / 10 * 10;
|
||||
res.put(time, Function.getString(s, "]", null));
|
||||
}
|
||||
return res;
|
||||
@@ -147,8 +147,8 @@ public class LyricDo {
|
||||
int temp5;
|
||||
if (yrc) {
|
||||
temp5 = (Integer.parseInt(temp8[0]) / 10 * 10);
|
||||
if (temp5 > 0 && temp5 + AllMusic.getConfig().KDelay > 0)
|
||||
temp5 += (AllMusic.getConfig().KDelay / 10 * 10);
|
||||
if (temp5 > 0 && temp5 + AllMusic.getConfig().ktvLyricDelay > 0)
|
||||
temp5 += (AllMusic.getConfig().ktvLyricDelay / 10 * 10);
|
||||
res.put(temp5, data);
|
||||
} else {
|
||||
try {
|
||||
@@ -159,8 +159,8 @@ public class LyricDo {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (temp5 > 0 && temp5 + AllMusic.getConfig().KDelay > 0)
|
||||
temp5 += (AllMusic.getConfig().KDelay / 10 * 10);
|
||||
if (temp5 > 0 && temp5 + AllMusic.getConfig().ktvLyricDelay > 0)
|
||||
temp5 += (AllMusic.getConfig().ktvLyricDelay / 10 * 10);
|
||||
res.put(now, data);
|
||||
now += temp5;
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ public class MusicSearch {
|
||||
if (obj != null) {
|
||||
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]));
|
||||
AllMusic.side.sendMessaget(obj.sender, AllMusic.getMessage().search
|
||||
.cantSearch.replace("%Music%", obj.isDefault ? obj.args[0] : obj.args[1]));
|
||||
else {
|
||||
AllMusic.side.sendMessaget(obj.sender, AllMusic.getMessage().Search.Res);
|
||||
AllMusic.side.sendMessaget(obj.sender, AllMusic.getMessage().search.res);
|
||||
AllMusic.addSearch(obj.name, search);
|
||||
AllMusic.side.runTask(() -> CommandEX.showSearch(obj.sender, search));
|
||||
}
|
||||
|
||||
+114
-39
@@ -1,9 +1,11 @@
|
||||
package coloryr.allmusic.core.music.play;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -17,13 +19,23 @@ public class PlayGo {
|
||||
* 倒数计数器
|
||||
*/
|
||||
private static int count = 0;
|
||||
private static int ping = 0;
|
||||
private static boolean isRun;
|
||||
/**
|
||||
* 歌曲更新计数器
|
||||
*/
|
||||
private static int times = 0;
|
||||
/**
|
||||
* 歌曲定时器
|
||||
*/
|
||||
private static ScheduledExecutorService service;
|
||||
/**
|
||||
* 歌词定时器
|
||||
*/
|
||||
private static ScheduledExecutorService service1;
|
||||
/**
|
||||
* 事务定时器
|
||||
*/
|
||||
private static ScheduledExecutorService service2;
|
||||
|
||||
/**
|
||||
@@ -35,7 +47,7 @@ public class PlayGo {
|
||||
taskT.start();
|
||||
|
||||
service2 = Executors.newSingleThreadScheduledExecutor();
|
||||
service2.scheduleAtFixedRate(PlayGo::time3, 0, 10, TimeUnit.SECONDS);
|
||||
service2.scheduleAtFixedRate(PlayGo::time3, 0, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,6 +55,10 @@ public class PlayGo {
|
||||
*/
|
||||
public static void stop() {
|
||||
closeTimer();
|
||||
if (service2 != null) {
|
||||
service2.shutdown();
|
||||
service2 = null;
|
||||
}
|
||||
isRun = false;
|
||||
PlayMusic.musicLessTime = 0;
|
||||
}
|
||||
@@ -56,10 +72,6 @@ public class PlayGo {
|
||||
service1.shutdown();
|
||||
service1 = null;
|
||||
}
|
||||
if (service2 != null) {
|
||||
service2.shutdown();
|
||||
service2 = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void startTimer() {
|
||||
@@ -85,6 +97,9 @@ public class PlayGo {
|
||||
HudUtils.clearHud();
|
||||
}
|
||||
|
||||
/**
|
||||
* 歌曲时间定时器
|
||||
*/
|
||||
private static void time1() {
|
||||
PlayMusic.musicNowTime += 10;
|
||||
count++;
|
||||
@@ -94,19 +109,22 @@ public class PlayGo {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 歌词更新
|
||||
*/
|
||||
private static void time2() {
|
||||
try {
|
||||
if (PlayMusic.lyric == null)
|
||||
return;
|
||||
boolean res = PlayMusic.lyric
|
||||
.checkTime(PlayMusic.musicNowTime, AllMusic.getConfig().KtvMode);
|
||||
.checkTime(PlayMusic.musicNowTime, AllMusic.getConfig().ktvMode);
|
||||
if (res) {
|
||||
times = 0;
|
||||
HudUtils.sendHudLyricData();
|
||||
AllMusic.side.updateLyric();
|
||||
} else {
|
||||
times++;
|
||||
if (times == 500 && PlayMusic.lyric != null) {
|
||||
if (times == AllMusic.getConfig().sendDelay / 2 && PlayMusic.lyric != null) {
|
||||
times = 0;
|
||||
HudUtils.sendHudLyricData();
|
||||
AllMusic.side.updateLyric();
|
||||
@@ -117,14 +135,88 @@ public class PlayGo {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean checkPush() {
|
||||
if (PlayMusic.push != null) {
|
||||
SongInfoObj push = PlayMusic.push;
|
||||
if (PlayMusic.nowPlayMusic.getID().equalsIgnoreCase(push.getID())) {
|
||||
PlayMusic.voteTime = 0;
|
||||
AllMusic.side.bqt(AllMusic.getMessage().push.cancel);
|
||||
return false;
|
||||
}
|
||||
List<SongInfoObj> list = PlayMusic.getList();
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
SongInfoObj id1 = list.get(0);
|
||||
if (id1 != null && id1.getID().equalsIgnoreCase(push.getID())) {
|
||||
return false;
|
||||
}
|
||||
for (int a = 1; a < list.size(); a++) {
|
||||
id1 = list.get(a);
|
||||
if (id1.getID().equalsIgnoreCase(push.getID()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务定时器
|
||||
*/
|
||||
private static void time3() {
|
||||
AllMusic.side.ping();
|
||||
ping++;
|
||||
if (ping >= 10) {
|
||||
AllMusic.side.ping();
|
||||
}
|
||||
if (PlayMusic.pushTime > 0) {
|
||||
if (!checkPush()) {
|
||||
PlayMusic.push = null;
|
||||
PlayMusic.pushTime = 0;
|
||||
AllMusic.side.bqt(AllMusic.getMessage().push.cancel);
|
||||
} else {
|
||||
PlayMusic.pushTime--;
|
||||
if (PlayMusic.pushTime == 0) {
|
||||
PlayMusic.push = null;
|
||||
AllMusic.clearPush();
|
||||
AllMusic.side.bqt(AllMusic.getMessage().push.timeOut);
|
||||
} else {
|
||||
int players = AllMusic.side.getAllPlayer();
|
||||
if (AllMusic.getVoteCount() >= AllMusic.getConfig().minVote
|
||||
|| (players <= AllMusic.getConfig().minVote
|
||||
&& players <= AllMusic.getVoteCount())) {
|
||||
SongInfoObj info = PlayMusic.push;
|
||||
PlayMusic.push = null;
|
||||
PlayMusic.pushMusic(info);
|
||||
AllMusic.side.bqt(AllMusic.getMessage().push.doPush);
|
||||
AllMusic.clearPush();
|
||||
PlayMusic.pushTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PlayMusic.voteTime > 0) {
|
||||
PlayMusic.voteTime--;
|
||||
if (PlayMusic.voteTime == 0) {
|
||||
AllMusic.clearPush();
|
||||
AllMusic.side.bqt(AllMusic.getMessage().vote.timeOut);
|
||||
} else {
|
||||
int players = AllMusic.side.getAllPlayer();
|
||||
if (AllMusic.getVoteCount() >= AllMusic.getConfig().minVote
|
||||
|| (players <= AllMusic.getConfig().minVote
|
||||
&& players <= AllMusic.getVoteCount())) {
|
||||
AllMusic.side.bqt(AllMusic.getMessage().vote.voteDone);
|
||||
AllMusic.clearVote();
|
||||
PlayMusic.voteTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void task() {
|
||||
while (isRun) {
|
||||
try {
|
||||
if (PlayMusic.getSize() == 0) {
|
||||
if (PlayMusic.getListSize() == 0) {
|
||||
if (PlayMusic.error >= 10) {
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
@@ -132,7 +224,7 @@ public class PlayGo {
|
||||
HudUtils.sendHudLyricData();
|
||||
HudUtils.sendHudListData();
|
||||
if (AllMusic.side.needPlay()) {
|
||||
String ID = AllMusic.getMusicApi().getListMusic();
|
||||
String ID = PlayMusic.getIdleMusic();
|
||||
if (ID != null) {
|
||||
MusicObj obj = new MusicObj();
|
||||
obj.sender = ID;
|
||||
@@ -151,7 +243,7 @@ public class PlayGo {
|
||||
AllMusic.side.sendHudUtilsAll();
|
||||
PlayMusic.nowPlayMusic = PlayMusic.remove(0);
|
||||
if (AllMusic.side.onMusicPlay(PlayMusic.nowPlayMusic)) {
|
||||
AllMusic.side.bqt(AllMusic.getMessage().MusicPlay.Cancel);
|
||||
AllMusic.side.bqt(AllMusic.getMessage().musicPlay.cancel);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -159,7 +251,7 @@ public class PlayGo {
|
||||
AllMusic.getMusicApi().getPlayUrl(PlayMusic.nowPlayMusic.getID()) :
|
||||
PlayMusic.nowPlayMusic.getPlayerUrl();
|
||||
if (url == null) {
|
||||
String data = AllMusic.getMessage().MusicPlay.NoCanPlay;
|
||||
String data = AllMusic.getMessage().musicPlay.emptyCanPlay;
|
||||
AllMusic.side.bqt(data.replace("%MusicID%", PlayMusic.nowPlayMusic.getID()));
|
||||
PlayMusic.nowPlayMusic = null;
|
||||
continue;
|
||||
@@ -174,18 +266,18 @@ public class PlayGo {
|
||||
PlayMusic.musicAllTime = PlayMusic.musicLessTime = (PlayMusic.nowPlayMusic.getLength() / 1000) + 3;
|
||||
startTimer();
|
||||
AllMusic.side.sendMusic(url);
|
||||
if (!AllMusic.getConfig().MutePlayMessage) {
|
||||
String info = AllMusic.getMessage().MusicPlay.Play
|
||||
if (!AllMusic.getConfig().mutePlayMessage) {
|
||||
String info = AllMusic.getMessage().musicPlay.nowPlay
|
||||
.replace("%MusicName%", PlayMusic.nowPlayMusic.getName())
|
||||
.replace("%MusicAuthor%", PlayMusic.nowPlayMusic.getAuthor())
|
||||
.replace("%MusicAl%", PlayMusic.nowPlayMusic.getAl())
|
||||
.replace("%MusicAlia%", PlayMusic.nowPlayMusic.getAlia())
|
||||
.replace("%PlayerName%", PlayMusic.nowPlayMusic.getCall());
|
||||
if(AllMusic.getConfig().MessageLimit
|
||||
&& info.length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
info = info.substring(0, AllMusic.getConfig().MessageLimitSize) + "...";
|
||||
if(AllMusic.getConfig().messageLimit
|
||||
&& info.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
info = info.substring(0, AllMusic.getConfig().messageLimitSize) + "...";
|
||||
}
|
||||
if (AllMusic.getConfig().ShowInBar)
|
||||
if (AllMusic.getConfig().showInBar)
|
||||
AllMusic.side.sendBar(info);
|
||||
else
|
||||
AllMusic.side.bqt(info);
|
||||
@@ -194,7 +286,7 @@ public class PlayGo {
|
||||
AllMusic.side.sendPic(PlayMusic.nowPlayMusic.getPicUrl());
|
||||
}
|
||||
if (PlayMusic.nowPlayMusic.isTrial()) {
|
||||
AllMusic.side.bqt(AllMusic.getMessage().MusicPlay.Trail);
|
||||
AllMusic.side.bqt(AllMusic.getMessage().musicPlay.trail);
|
||||
PlayMusic.musicLessTime = PlayMusic.nowPlayMusic.getTrialInfo().getEnd();
|
||||
PlayMusic.musicNowTime = PlayMusic.nowPlayMusic.getTrialInfo().getStart();
|
||||
}
|
||||
@@ -207,28 +299,11 @@ public class PlayGo {
|
||||
if (!AllMusic.side.needPlay()) {
|
||||
PlayMusic.musicLessTime = 1;
|
||||
}
|
||||
if (PlayMusic.voteTime > 0) {
|
||||
PlayMusic.voteTime--;
|
||||
if (PlayMusic.voteTime == 0) {
|
||||
AllMusic.clearVote();
|
||||
AllMusic.side.bqt(AllMusic.getMessage().Vote.TimeOut);
|
||||
} else {
|
||||
int players = AllMusic.side.getAllPlayer();
|
||||
if (AllMusic.getVoteCount() >= AllMusic.getConfig().MinVote
|
||||
|| (players <= AllMusic.getConfig().MinVote
|
||||
&& players <= AllMusic.getVoteCount())) {
|
||||
AllMusic.side.bqt(AllMusic.getMessage().Vote.Do);
|
||||
AllMusic.clearVote();
|
||||
PlayMusic.voteTime = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(AllMusic.getConfig().sendDelay);
|
||||
}
|
||||
AllMusic.side.sendStop();
|
||||
} else {
|
||||
String data = AllMusic.getMessage().MusicPlay.NoCanPlay;
|
||||
String data = AllMusic.getMessage().musicPlay.emptyCanPlay;
|
||||
AllMusic.side.bqt(data.replace("%MusicID%", PlayMusic.nowPlayMusic.getID()));
|
||||
}
|
||||
clear();
|
||||
|
||||
+129
-27
@@ -5,6 +5,7 @@ import coloryr.allmusic.core.decoder.Bitstream;
|
||||
import coloryr.allmusic.core.decoder.Header;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.sql.DataSql;
|
||||
import coloryr.allmusic.core.utils.Logs;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
@@ -13,20 +14,24 @@ import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class PlayMusic {
|
||||
|
||||
/**
|
||||
* 播放列表
|
||||
*/
|
||||
private static final List<SongInfoObj> playList = new CopyOnWriteArrayList<>();
|
||||
private static final List<SongInfoObj> playList = new ArrayList<>();
|
||||
private static final Queue<MusicObj> tasks = new ConcurrentLinkedQueue<>();
|
||||
private static final List<String> playIdleList = new ArrayList<>();
|
||||
/**
|
||||
* 投票时间
|
||||
*/
|
||||
public static int voteTime = 0;
|
||||
public static String voteSender;
|
||||
public static int pushTime = 0;
|
||||
public static String pushSender;
|
||||
/**
|
||||
* 总歌曲长度
|
||||
*/
|
||||
@@ -52,6 +57,9 @@ public class PlayMusic {
|
||||
*/
|
||||
public static int error;
|
||||
private static boolean isRun;
|
||||
private static int idleNow;
|
||||
|
||||
public static SongInfoObj push;
|
||||
|
||||
/**
|
||||
* 停止歌曲逻辑
|
||||
@@ -107,10 +115,10 @@ public class PlayMusic {
|
||||
* @param isList 是否是空闲歌单
|
||||
*/
|
||||
public static void addMusic(Object sender, String id, String player, boolean isList) {
|
||||
if (isHave(id))
|
||||
if (haveMusic(id))
|
||||
return;
|
||||
if (sender != null) {
|
||||
String text = AllMusic.getMessage().MusicPlay.CheckMusic;
|
||||
String text = AllMusic.getMessage().musicPlay.checkMusic;
|
||||
text = text.replace("%MusicID%", id);
|
||||
AllMusic.side.sendMessaget(sender, text);
|
||||
}
|
||||
@@ -119,55 +127,68 @@ public class PlayMusic {
|
||||
SongInfoObj info = AllMusic.getMusicApi().getMusic(id, player, isList);
|
||||
if (info == null) {
|
||||
if (sender != null) {
|
||||
String data = AllMusic.getMessage().MusicPlay.NoCanPlay;
|
||||
String data = AllMusic.getMessage().musicPlay.emptyCanPlay;
|
||||
AllMusic.side.sendMessaget(sender, data.replace("%MusicID%", id));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (info.getLength() / 1000 > AllMusic.getConfig().MaxMusicTime) {
|
||||
AllMusic.side.sendMessaget(sender, AllMusic.getMessage().AddMusic.TimeOut);
|
||||
if (info.getLength() / 1000 > AllMusic.getConfig().maxMusicTime) {
|
||||
AllMusic.side.sendMessaget(sender, AllMusic.getMessage().addMusic.timeOut);
|
||||
return;
|
||||
}
|
||||
playList.add(info);
|
||||
if (!AllMusic.getConfig().MuteAddMessage) {
|
||||
String data = AllMusic.getMessage().MusicPlay.AddMusic
|
||||
if (!AllMusic.getConfig().muteAddMessage) {
|
||||
String data = AllMusic.getMessage().musicPlay.addMusic
|
||||
.replace("%MusicName%", info.getName())
|
||||
.replace("%MusicAuthor%", info.getAuthor())
|
||||
.replace("%MusicAl%", info.getAl())
|
||||
.replace("%MusicAlia%", info.getAlia());
|
||||
if(AllMusic.getConfig().MessageLimit
|
||||
&& data.length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().MessageLimitSize) + "...";
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& data.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().messageLimitSize) + "...";
|
||||
}
|
||||
if (AllMusic.getConfig().ShowInBar) {
|
||||
if (AllMusic.getConfig().showInBar) {
|
||||
AllMusic.side.sendBar(data);
|
||||
} else {
|
||||
AllMusic.side.bqt(data);
|
||||
}
|
||||
}
|
||||
if (AllMusic.getConfig().PlayListSwitch
|
||||
if (AllMusic.getConfig().playListSwitch
|
||||
&& (PlayMusic.nowPlayMusic != null && PlayMusic.nowPlayMusic.isList())) {
|
||||
PlayMusic.musicLessTime = 1;
|
||||
if (!isList)
|
||||
AllMusic.side.bqt(AllMusic.getMessage().MusicPlay.Switch);
|
||||
AllMusic.side.bqt(AllMusic.getMessage().musicPlay.switchMusic);
|
||||
}
|
||||
error = 0;
|
||||
} catch (Exception e) {
|
||||
if (isList) {
|
||||
error++;
|
||||
}
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲信息解析错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌曲信息解析错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将歌曲移动到队列头
|
||||
* @param obj
|
||||
*/
|
||||
public static void pushMusic(SongInfoObj obj) {
|
||||
synchronized (playList) {
|
||||
playList.remove(obj);
|
||||
playList.add(0, obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取播放列表长度
|
||||
*
|
||||
* @return 长度
|
||||
*/
|
||||
public static int getSize() {
|
||||
return playList.size();
|
||||
public static int getListSize() {
|
||||
synchronized (playList) {
|
||||
return playList.size();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,14 +197,18 @@ public class PlayMusic {
|
||||
* @return 播放列表
|
||||
*/
|
||||
public static List<SongInfoObj> getList() {
|
||||
return new ArrayList<>(playList);
|
||||
synchronized (playList) {
|
||||
return new ArrayList<>(playList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理播放列表
|
||||
*/
|
||||
public static void clear() {
|
||||
playList.clear();
|
||||
synchronized (playList) {
|
||||
playList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,7 +218,19 @@ public class PlayMusic {
|
||||
* @return 结果
|
||||
*/
|
||||
public static SongInfoObj remove(int index) {
|
||||
return playList.remove(index);
|
||||
synchronized (playList) {
|
||||
return playList.remove(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从播放列表删除
|
||||
* @param index
|
||||
*/
|
||||
public static void remove(SongInfoObj index) {
|
||||
synchronized (playList) {
|
||||
playList.remove(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +245,7 @@ public class PlayMusic {
|
||||
SongInfoObj info;
|
||||
for (int i = 0; i < playList.size(); i++) {
|
||||
info = playList.get(i);
|
||||
a = AllMusic.getMessage().MusicPlay.ListMusic.Item;
|
||||
a = AllMusic.getMessage().musicPlay.listMusic.item;
|
||||
a = a.replace("%Index%", "" + (i + 1))
|
||||
.replace("%MusicName%", info.getName())
|
||||
.replace("%MusicAuthor%", info.getAuthor())
|
||||
@@ -228,7 +265,7 @@ public class PlayMusic {
|
||||
* @param id 音乐ID
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isHave(String id) {
|
||||
public static boolean haveMusic(String id) {
|
||||
if (nowPlayMusic != null && nowPlayMusic.getID().equalsIgnoreCase(id))
|
||||
return true;
|
||||
for (SongInfoObj item : playList) {
|
||||
@@ -253,20 +290,20 @@ public class PlayMusic {
|
||||
Header h = bt.readFrame();
|
||||
int le = 6000000;
|
||||
if (h == null) {
|
||||
AllMusic.side.bqt("§d[AllMusic]§c未知音乐类型");
|
||||
AllMusic.side.bqt("§d[AllMusic3]§c未知音乐类型");
|
||||
} else {
|
||||
le = (int) h.total_ms(b);
|
||||
}
|
||||
SongInfoObj info = new SongInfoObj(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歌曲信息解析错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c歌曲信息解析错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean havePlayer(String name) {
|
||||
int list = AllMusic.getConfig().PlayerMaxList;
|
||||
int list = AllMusic.getConfig().maxPlayerList;
|
||||
if (list == 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -279,5 +316,70 @@ public class PlayMusic {
|
||||
|
||||
return list <= count;
|
||||
}
|
||||
|
||||
public static void addIdleList(List<String> list) {
|
||||
playIdleList.addAll(list);
|
||||
}
|
||||
|
||||
public static void clearIdleList() {
|
||||
playIdleList.clear();
|
||||
DataSql.clearIdleList();
|
||||
}
|
||||
|
||||
public static int getIdleListSize() {
|
||||
return playIdleList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取空闲歌单的一首歌
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public static String getIdleMusic() {
|
||||
if (AllMusic.getMusicApi().isUpdate()) {
|
||||
return null;
|
||||
}
|
||||
String ID;
|
||||
if (playIdleList.isEmpty())
|
||||
return null;
|
||||
if (AllMusic.getConfig().playListRandom) {
|
||||
if (playIdleList.size() == 1)
|
||||
return playIdleList.get(0);
|
||||
ID = playIdleList.get(new Random().nextInt(playIdleList.size()));
|
||||
} else {
|
||||
ID = playIdleList.get(idleNow);
|
||||
idleNow++;
|
||||
if (idleNow >= playIdleList.size())
|
||||
{
|
||||
idleNow = 0;
|
||||
}
|
||||
}
|
||||
return ID;
|
||||
}
|
||||
|
||||
public static SongInfoObj findPlayerMusic(String name) {
|
||||
List<SongInfoObj> list1 = getList();
|
||||
for (int a = 0; a < playList.size(); a++) {
|
||||
SongInfoObj item = list1.get(a);
|
||||
if (name.equalsIgnoreCase(item.getCall())) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SongInfoObj findMusicIndex(int index) {
|
||||
List<SongInfoObj> list1 = getList();
|
||||
index--;
|
||||
if (index <= 0) {
|
||||
return null;
|
||||
}
|
||||
if (list1.size() <= index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return list1.get(index);
|
||||
}
|
||||
}
|
||||
|
||||
+91
-113
@@ -2,9 +2,7 @@ package coloryr.allmusic.core.objs.config;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -14,250 +12,230 @@ public class ConfigObj {
|
||||
/**
|
||||
* 最大歌曲数
|
||||
*/
|
||||
public int MaxList;
|
||||
public int maxPlayList;
|
||||
/**
|
||||
* 一个玩家最大可点数量
|
||||
*/
|
||||
public int PlayerMaxList;
|
||||
public int maxPlayerList;
|
||||
/**
|
||||
* 最小通过投票数
|
||||
*/
|
||||
public int MinVote;
|
||||
public int minVote;
|
||||
/**
|
||||
* 投票时间
|
||||
*/
|
||||
public int VoteTime;
|
||||
public int voteTime;
|
||||
/**
|
||||
* 歌曲延迟
|
||||
*/
|
||||
public int Delay;
|
||||
public int lyricDelay;
|
||||
/**
|
||||
* 搜歌花费
|
||||
*/
|
||||
public int SearchCost;
|
||||
public int searchCost;
|
||||
/**
|
||||
* 点歌花费
|
||||
*/
|
||||
public int AddMusicCost;
|
||||
public int addMusicCost;
|
||||
/**
|
||||
* 默认添加歌曲方式
|
||||
*/
|
||||
public int DefaultAddMusic;
|
||||
public int defaultAddMusic;
|
||||
/**
|
||||
* 消息限制长度
|
||||
*/
|
||||
public int MessageLimitSize;
|
||||
public int messageLimitSize;
|
||||
/**
|
||||
* 最长音乐长度
|
||||
*/
|
||||
public int MaxMusicTime;
|
||||
public int maxMusicTime;
|
||||
/**
|
||||
* KTV模式歌词加时
|
||||
*/
|
||||
public int KDelay;
|
||||
|
||||
public int ktvLyricDelay;
|
||||
/**
|
||||
* 管理员ID列表
|
||||
*/
|
||||
public Set<String> Admin;
|
||||
public Set<String> adminList;
|
||||
/**
|
||||
* 不参与点歌的服务器列表
|
||||
*/
|
||||
public Set<String> NoMusicServer;
|
||||
public Set<String> muteServer;
|
||||
/**
|
||||
* 不参与点歌的玩家列表
|
||||
*/
|
||||
public Set<String> NoMusicPlayer;
|
||||
public Set<String> mutePlayer;
|
||||
/**
|
||||
* 禁止点歌ID列表
|
||||
*/
|
||||
public Set<String> BanMusic;
|
||||
/**
|
||||
* 空闲歌单列表
|
||||
*/
|
||||
public List<String> PlayList;
|
||||
public Set<String> banMusic;
|
||||
/**
|
||||
* 禁止玩家点歌列表
|
||||
*/
|
||||
public Set<String> BanPlayer;
|
||||
public Set<String> banPlayer;
|
||||
/**
|
||||
* 玩家点歌后是否直接从空闲歌单切换至玩家歌曲
|
||||
*/
|
||||
public boolean PlayListSwitch;
|
||||
public boolean playListSwitch;
|
||||
/**
|
||||
* 空闲歌单随机播放
|
||||
*/
|
||||
public boolean PlayListRandom;
|
||||
public boolean playListRandom;
|
||||
/**
|
||||
* 显示歌词
|
||||
*/
|
||||
public boolean SendLyric;
|
||||
public boolean sendLyric;
|
||||
/**
|
||||
* 指令需要权限
|
||||
*/
|
||||
public boolean NeedPermission;
|
||||
public boolean needPermission;
|
||||
/**
|
||||
* 开启花钱点歌
|
||||
*/
|
||||
public boolean UseCost;
|
||||
public boolean useCost;
|
||||
/**
|
||||
* 顶层模式,用于和BC交换数据
|
||||
*/
|
||||
public boolean TopPAPI;
|
||||
public boolean topPAPI;
|
||||
/**
|
||||
* 开启信息长度限制
|
||||
*/
|
||||
public boolean MessageLimit;
|
||||
public boolean messageLimit;
|
||||
/**
|
||||
* 不发送播放信息
|
||||
*/
|
||||
public boolean MutePlayMessage;
|
||||
public boolean mutePlayMessage;
|
||||
/**
|
||||
* 不发送点歌信息
|
||||
*/
|
||||
public boolean MuteAddMessage;
|
||||
public boolean muteAddMessage;
|
||||
/**
|
||||
* 将信息限制在bar处
|
||||
*/
|
||||
public boolean ShowInBar;
|
||||
public boolean showInBar;
|
||||
/**
|
||||
* K歌歌词
|
||||
*/
|
||||
public boolean KtvMode;
|
||||
|
||||
/**
|
||||
* 登录的用户
|
||||
*/
|
||||
public String LoginUser;
|
||||
public boolean ktvMode;
|
||||
/**
|
||||
* 歌曲音质
|
||||
*/
|
||||
public String MusicBR;
|
||||
public String musicBR;
|
||||
/**
|
||||
* 配置文件版本号
|
||||
*/
|
||||
public String Version;
|
||||
|
||||
public String version;
|
||||
/**
|
||||
* 默认的Hud配置
|
||||
*/
|
||||
public SaveObj DefaultHud;
|
||||
public SaveObj defaultHud;
|
||||
/**
|
||||
* 经济插件挂钩
|
||||
*/
|
||||
public EconomyObj Economy;
|
||||
public EconomyObj economy;
|
||||
/**
|
||||
* 娱乐选项
|
||||
*/
|
||||
public FunConfigObj FunConfig;
|
||||
public FunConfigObj funConfig;
|
||||
/**
|
||||
* 信息更新延迟
|
||||
*/
|
||||
public int sendDelay;
|
||||
|
||||
public void addBanMusic(String id) {
|
||||
BanMusic.add(id);
|
||||
banMusic.add(id);
|
||||
AllMusic.saveConfig();
|
||||
}
|
||||
|
||||
public void addBanPlayer(String id) {
|
||||
BanPlayer.add(id);
|
||||
banPlayer.add(id);
|
||||
AllMusic.saveConfig();
|
||||
}
|
||||
|
||||
public void AddNoMusicPlayer(String ID) {
|
||||
NoMusicPlayer.add(ID);
|
||||
mutePlayer.add(ID);
|
||||
AllMusic.saveConfig();
|
||||
}
|
||||
|
||||
public void RemoveNoMusicPlayer(String ID) {
|
||||
NoMusicPlayer.remove(ID);
|
||||
mutePlayer.remove(ID);
|
||||
AllMusic.saveConfig();
|
||||
}
|
||||
|
||||
public boolean check() {
|
||||
boolean saveConfig = false;
|
||||
if (PlayList == null) {
|
||||
if (adminList == null) {
|
||||
saveConfig = true;
|
||||
PlayList = new ArrayList<>();
|
||||
adminList = new HashSet<>();
|
||||
}
|
||||
if (Admin == null) {
|
||||
if (banMusic == null) {
|
||||
saveConfig = true;
|
||||
Admin = new HashSet<>();
|
||||
banMusic = new HashSet<>();
|
||||
}
|
||||
if (BanMusic == null) {
|
||||
if (banPlayer == null) {
|
||||
saveConfig = true;
|
||||
BanMusic = new HashSet<>();
|
||||
banPlayer = new HashSet<>();
|
||||
}
|
||||
if (BanPlayer == null) {
|
||||
if (defaultHud == null) {
|
||||
saveConfig = true;
|
||||
BanPlayer = new HashSet<>();
|
||||
defaultHud = SaveObj.make();
|
||||
}
|
||||
if (DefaultHud == null) {
|
||||
if (mutePlayer == null) {
|
||||
saveConfig = true;
|
||||
DefaultHud = SaveObj.make();
|
||||
mutePlayer = new HashSet<>();
|
||||
}
|
||||
if (NoMusicPlayer == null) {
|
||||
if (muteServer == null) {
|
||||
saveConfig = true;
|
||||
NoMusicPlayer = new HashSet<>();
|
||||
muteServer = new HashSet<>();
|
||||
}
|
||||
if (NoMusicServer == null) {
|
||||
if (economy == null || economy.check()) {
|
||||
saveConfig = true;
|
||||
NoMusicServer = new HashSet<>();
|
||||
economy = EconomyObj.make();
|
||||
}
|
||||
if (Economy == null || Economy.check()) {
|
||||
if (funConfig == null) {
|
||||
saveConfig = true;
|
||||
Economy = EconomyObj.make();
|
||||
}
|
||||
if (FunConfig == null) {
|
||||
saveConfig = true;
|
||||
FunConfig = FunConfigObj.make();
|
||||
funConfig = FunConfigObj.make();
|
||||
}
|
||||
|
||||
return saveConfig;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
PlayerMaxList = 0;
|
||||
MaxList = 10;
|
||||
MinVote = 3;
|
||||
VoteTime = 30;
|
||||
Delay = 0;
|
||||
Admin = new HashSet<>();
|
||||
Admin.add("CONSOLE");
|
||||
Admin.add("Color_yr");
|
||||
NoMusicServer = new HashSet<>();
|
||||
NoMusicPlayer = new HashSet<>();
|
||||
BanMusic = new HashSet<>();
|
||||
PlayList = new ArrayList<>();
|
||||
BanPlayer = new HashSet<>();
|
||||
PlayListSwitch = true;
|
||||
PlayListRandom = true;
|
||||
SendLyric = true;
|
||||
NeedPermission = false;
|
||||
DefaultHud = SaveObj.make();
|
||||
|
||||
UseCost = false;
|
||||
SearchCost = 20;
|
||||
MutePlayMessage = false;
|
||||
MuteAddMessage = false;
|
||||
ShowInBar = false;
|
||||
AddMusicCost = 10;
|
||||
|
||||
DefaultAddMusic = 0;
|
||||
LoginUser = "";
|
||||
|
||||
MusicBR = "320000";
|
||||
|
||||
MaxMusicTime = 600;
|
||||
|
||||
TopPAPI = false;
|
||||
MessageLimit = false;
|
||||
MessageLimitSize = 40;
|
||||
|
||||
Economy = EconomyObj.make();
|
||||
FunConfig = FunConfigObj.make();
|
||||
|
||||
KtvMode = true;
|
||||
KDelay = 0;
|
||||
|
||||
Version = AllMusic.configVersion;
|
||||
maxPlayerList = 0;
|
||||
maxPlayList = 10;
|
||||
minVote = 3;
|
||||
voteTime = 30;
|
||||
adminList = new HashSet<>();
|
||||
adminList.add("CONSOLE");
|
||||
adminList.add("Color_yr");
|
||||
muteServer = new HashSet<>();
|
||||
mutePlayer = new HashSet<>();
|
||||
banMusic = new HashSet<>();
|
||||
banPlayer = new HashSet<>();
|
||||
playListSwitch = true;
|
||||
playListRandom = true;
|
||||
sendLyric = true;
|
||||
needPermission = false;
|
||||
defaultHud = SaveObj.make();
|
||||
useCost = false;
|
||||
searchCost = 20;
|
||||
mutePlayMessage = false;
|
||||
muteAddMessage = false;
|
||||
showInBar = false;
|
||||
addMusicCost = 10;
|
||||
defaultAddMusic = 0;
|
||||
musicBR = "320000";
|
||||
maxMusicTime = 600;
|
||||
topPAPI = false;
|
||||
messageLimit = false;
|
||||
messageLimitSize = 40;
|
||||
economy = EconomyObj.make();
|
||||
funConfig = FunConfigObj.make();
|
||||
ktvMode = true;
|
||||
ktvLyricDelay = 0;
|
||||
lyricDelay = 0;
|
||||
sendDelay = 1000;
|
||||
version = AllMusic.configVersion;
|
||||
}
|
||||
|
||||
public static ConfigObj make() {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package coloryr.allmusic.core.objs.config;
|
||||
|
||||
public class EconomyObj {
|
||||
public String MysqlUrl;
|
||||
public String Backend;
|
||||
public boolean Vault;
|
||||
public String mysqlUrl;
|
||||
public String backend;
|
||||
public boolean vault;
|
||||
|
||||
public boolean check() {
|
||||
boolean res = MysqlUrl == null;
|
||||
boolean res = mysqlUrl == null;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Backend = "Server1";
|
||||
MysqlUrl = "jdbc:mysql://localhost:3306/minecraft?autoReconnect=true&autoReconnectForPools=true";
|
||||
Vault = true;
|
||||
backend = "Server1";
|
||||
mysqlUrl = "jdbc:mysql://localhost:3306/minecraft?autoReconnect=true&autoReconnectForPools=true";
|
||||
vault = true;
|
||||
}
|
||||
|
||||
public static EconomyObj make() {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package coloryr.allmusic.core.objs.config;
|
||||
|
||||
public class FunConfigObj {
|
||||
public boolean Rain;
|
||||
public int RainRate;
|
||||
public boolean rain;
|
||||
public int rainRate;
|
||||
|
||||
public void init() {
|
||||
Rain = true;
|
||||
RainRate = 10;
|
||||
rain = true;
|
||||
rainRate = 10;
|
||||
}
|
||||
|
||||
public static FunConfigObj make() {
|
||||
|
||||
@@ -1,69 +1,52 @@
|
||||
package coloryr.allmusic.core.objs.config;
|
||||
|
||||
import coloryr.allmusic.core.objs.enums.HudDirType;
|
||||
import coloryr.allmusic.core.objs.hud.PosObj;
|
||||
|
||||
public class SaveObj {
|
||||
public PosObj List;
|
||||
public PosObj Lyric;
|
||||
public PosObj Info;
|
||||
public PosObj Pic;
|
||||
public int PicSize;
|
||||
public int PicRotateSpeed;
|
||||
public boolean EnablePicRotate;
|
||||
public boolean EnableList;
|
||||
public boolean EnableLyric;
|
||||
public boolean EnableInfo;
|
||||
public boolean EnablePic;
|
||||
public PosObj list;
|
||||
public PosObj lyric;
|
||||
public PosObj info;
|
||||
public PosObj pic;
|
||||
public int picRotateSpeed;
|
||||
|
||||
public SaveObj copy() {
|
||||
SaveObj obj1 = new SaveObj();
|
||||
obj1.EnableInfo = this.EnableInfo;
|
||||
obj1.EnableList = this.EnableList;
|
||||
obj1.EnableLyric = this.EnableLyric;
|
||||
obj1.EnablePic = this.EnablePic;
|
||||
obj1.Info = this.Info.copy();
|
||||
obj1.List = this.List.copy();
|
||||
obj1.Lyric = this.Lyric.copy();
|
||||
obj1.Pic = this.Pic.copy();
|
||||
obj1.PicSize = this.PicSize;
|
||||
obj1.EnablePicRotate = this.EnablePicRotate;
|
||||
obj1.PicRotateSpeed = this.PicRotateSpeed;
|
||||
obj1.info = this.info.copy();
|
||||
obj1.list = this.list.copy();
|
||||
obj1.lyric = this.lyric.copy();
|
||||
obj1.pic = this.pic.copy();
|
||||
obj1.picRotateSpeed = this.picRotateSpeed;
|
||||
return obj1;
|
||||
}
|
||||
|
||||
public boolean check() {
|
||||
boolean save = false;
|
||||
if (List == null) {
|
||||
if (list == null) {
|
||||
save = true;
|
||||
List = new PosObj(2, 74);
|
||||
list = new PosObj(2, 74, HudDirType.TOP_LEFT, 0xffffff, false, true);
|
||||
}
|
||||
if (Lyric == null) {
|
||||
if (lyric == null) {
|
||||
save = true;
|
||||
Lyric = new PosObj(74, 53);
|
||||
lyric = new PosObj(74, 53, HudDirType.TOP_LEFT, 0xffffff, false, true);
|
||||
}
|
||||
if (Info == null) {
|
||||
if (info == null) {
|
||||
save = true;
|
||||
Info = new PosObj(74, 2);
|
||||
info = new PosObj(74, 2, HudDirType.TOP_LEFT, 0xffffff, false, true);
|
||||
}
|
||||
if (Pic == null) {
|
||||
if (pic == null) {
|
||||
save = true;
|
||||
Pic = new PosObj(2, 2);
|
||||
pic = new PosObj(2, 2, HudDirType.TOP_LEFT, 70, true, true);
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
EnableList = true;
|
||||
EnableLyric = true;
|
||||
EnableInfo = true;
|
||||
EnablePic = true;
|
||||
EnablePicRotate = true;
|
||||
PicRotateSpeed = 30;
|
||||
List = new PosObj(2, 74);
|
||||
Lyric = new PosObj(74, 53);
|
||||
Info = new PosObj(74, 2);
|
||||
Pic = new PosObj(2, 2);
|
||||
PicSize = 70;
|
||||
picRotateSpeed = 30;
|
||||
list = new PosObj(2, 74, HudDirType.TOP_LEFT, 0xffffff, false, true);
|
||||
lyric = new PosObj(74, 53, HudDirType.TOP_LEFT, 0xffffff, false, true);
|
||||
info = new PosObj(74, 2, HudDirType.TOP_LEFT, 0xffffff, false, true);
|
||||
pic = new PosObj(2, 2, HudDirType.TOP_LEFT, 0, false, true);
|
||||
}
|
||||
|
||||
public static SaveObj make() {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package coloryr.allmusic.core.objs.enums;
|
||||
|
||||
public enum ComType {
|
||||
LYRIC, INFO, LIST, PLAY, IMG,
|
||||
STOP, CLEAR, POS, HUD
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package coloryr.allmusic.core.enums;
|
||||
package coloryr.allmusic.core.objs.enums;
|
||||
|
||||
public enum EncryptType {
|
||||
WEAPI, EAPI, API
|
||||
@@ -0,0 +1,7 @@
|
||||
package coloryr.allmusic.core.objs.enums;
|
||||
|
||||
public enum HudDirType {
|
||||
TOP_LEFT, TOP_CENTER, TOP_RIGHT,
|
||||
LEFT, CENTER, RIGHT,
|
||||
BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package coloryr.allmusic.core.objs.enums;
|
||||
|
||||
public enum HudType {
|
||||
INFO, LIST, LYRIC, PIC
|
||||
}
|
||||
@@ -1,19 +1,29 @@
|
||||
package coloryr.allmusic.core.objs.hud;
|
||||
|
||||
import coloryr.allmusic.core.objs.enums.HudDirType;
|
||||
|
||||
public class PosObj {
|
||||
public int x;
|
||||
public int y;
|
||||
public HudDirType dir;
|
||||
public int color;
|
||||
public boolean shadow;
|
||||
public boolean enable;
|
||||
|
||||
public PosObj() {
|
||||
|
||||
}
|
||||
|
||||
public PosObj(int x, int y) {
|
||||
public PosObj(int x, int y, HudDirType type, int color, boolean shadow, boolean enable) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.dir = type;
|
||||
this.color = color;
|
||||
this.shadow = shadow;
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public PosObj copy() {
|
||||
return new PosObj(this.x, this.y);
|
||||
return new PosObj(this.x, this.y, this.dir, this.color, this.shadow, this.enable);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,50 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class AddMusicObj {
|
||||
public String ListFull;
|
||||
public String PlayerToMany;
|
||||
public String BanMusic;
|
||||
public String PlayerBan;
|
||||
public String ExistMusic;
|
||||
public String Success;
|
||||
public String NoPlayer;
|
||||
public String NoID;
|
||||
public String Cancel;
|
||||
public String TimeOut;
|
||||
public String listFull;
|
||||
public String playerToMany;
|
||||
public String banMusic;
|
||||
public String playerBan;
|
||||
public String existMusic;
|
||||
public String success;
|
||||
public String noPlayer;
|
||||
public String noID;
|
||||
public String cancel;
|
||||
public String timeOut;
|
||||
|
||||
public boolean check() {
|
||||
if (ListFull == null)
|
||||
if (listFull == null)
|
||||
return true;
|
||||
if (BanMusic == null)
|
||||
if (banMusic == null)
|
||||
return true;
|
||||
if (ExistMusic == null)
|
||||
if (existMusic == null)
|
||||
return true;
|
||||
if (Success == null)
|
||||
if (success == null)
|
||||
return true;
|
||||
if (NoPlayer == null)
|
||||
if (noPlayer == null)
|
||||
return true;
|
||||
if (NoID == null)
|
||||
if (noID == null)
|
||||
return true;
|
||||
if (Cancel == null)
|
||||
if (cancel == null)
|
||||
return true;
|
||||
if (PlayerToMany == null)
|
||||
if (playerToMany == null)
|
||||
return true;
|
||||
if (PlayerBan == null)
|
||||
if (playerBan == null)
|
||||
return true;
|
||||
return TimeOut == null;
|
||||
return timeOut == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
ListFull = "§d[AllMusic]§c错误,队列已满";
|
||||
PlayerToMany = "§d[AllMusic]§c错误,你点了太多的歌";
|
||||
PlayerBan = "§d[AllMusic]§c错误,你已被禁止点歌";
|
||||
BanMusic = "§d[AllMusic]§c错误,这首歌被禁点了";
|
||||
ExistMusic = "§d[AllMusic]§c错误,这首歌已经存在了";
|
||||
Success = "§d[AllMusic]§2点歌成功";
|
||||
NoPlayer = "§d[AllMusic]§c没有播放的玩家";
|
||||
NoID = "§d[AllMusic]§c错误,请输入歌曲数字ID";
|
||||
Cancel = "§d[AllMusic]§e点歌被取消";
|
||||
TimeOut = "§d[AllMusic]§e点歌被取消,音乐长度过长";
|
||||
listFull = "§d[AllMusic3]§c错误,队列已满";
|
||||
playerToMany = "§d[AllMusic3]§c错误,你点了太多的歌";
|
||||
playerBan = "§d[AllMusic3]§c错误,你已被禁止点歌";
|
||||
banMusic = "§d[AllMusic3]§c错误,这首歌被禁点了";
|
||||
existMusic = "§d[AllMusic3]§c错误,这首歌已经存在了";
|
||||
success = "§d[AllMusic3]§2点歌成功";
|
||||
noPlayer = "§d[AllMusic3]§c没有播放的玩家";
|
||||
noID = "§d[AllMusic3]§c错误,请输入歌曲数字ID";
|
||||
cancel = "§d[AllMusic3]§e点歌被取消";
|
||||
timeOut = "§d[AllMusic3]§e点歌被取消,音乐长度过长";
|
||||
}
|
||||
|
||||
public static AddMusicObj make() {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class CancelObj {
|
||||
public String done;
|
||||
public String err1;
|
||||
public String err2;
|
||||
public String err3;
|
||||
public String err4;
|
||||
|
||||
public boolean check() {
|
||||
if (err1 == null)
|
||||
return true;
|
||||
if (err2 == null)
|
||||
return true;
|
||||
if (err3 == null)
|
||||
return true;
|
||||
if (err4 == null)
|
||||
return true;
|
||||
return done == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
err1 = "§d[AllMusic3]§c你没有点歌";
|
||||
err2 = "§d[AllMusic3]§c歌曲%MusicName%-%MusicAuthor%不是你的点歌";
|
||||
err3 = "§d[AllMusic3]§c没有找到序号为%Index%的点歌";
|
||||
err4 = "§d[AllMusic3]§c输入的序号错误";
|
||||
done = "§d[AllMusic3]§e已取消你的点歌";
|
||||
}
|
||||
|
||||
public static CancelObj make() {
|
||||
CancelObj obj = new CancelObj();
|
||||
obj.init();
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class ClickObj {
|
||||
public String This;
|
||||
public String Check;
|
||||
public String clickRun;
|
||||
public String clickCheck;
|
||||
|
||||
public boolean check() {
|
||||
if (This == null)
|
||||
if (clickRun == null)
|
||||
return true;
|
||||
return Check == null;
|
||||
return clickCheck == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
This = "§b[§n点我选择§r§b]";
|
||||
Check = "§b[§n点我查看§r§b]";
|
||||
clickRun = "§b[§n点我选择§r§b]";
|
||||
clickCheck = "§b[§n点我查看§r§b]";
|
||||
}
|
||||
|
||||
public static ClickObj make() {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class CommandObj {
|
||||
public String Error;
|
||||
public String NoPer;
|
||||
public String error;
|
||||
public String noPer;
|
||||
|
||||
public boolean check() {
|
||||
if (Error == null)
|
||||
if (error == null)
|
||||
return true;
|
||||
return NoPer == null;
|
||||
return noPer == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Error = "§d[AllMusic]§c参数错误,请输入/music help获取帮助";
|
||||
NoPer = "§d[AllMusic]§c你没有权限点歌";
|
||||
error = "§d[AllMusic3]§c参数错误,请输入/music help获取帮助";
|
||||
noPer = "§d[AllMusic3]§c你没有权限执行这个操作";
|
||||
}
|
||||
|
||||
public static CommandObj make() {
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class CostObj {
|
||||
public String Search;
|
||||
public String AddMusic;
|
||||
public String NoMoney;
|
||||
public String CostFail;
|
||||
public String search;
|
||||
public String addMusic;
|
||||
public String noMoney;
|
||||
public String costFail;
|
||||
|
||||
public boolean check() {
|
||||
if (Search == null)
|
||||
if (search == null)
|
||||
return true;
|
||||
if (AddMusic == null)
|
||||
if (addMusic == null)
|
||||
return true;
|
||||
if (NoMoney == null)
|
||||
if (noMoney == null)
|
||||
return true;
|
||||
return CostFail == null;
|
||||
return costFail == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Search = "§d[AllMusic]§e你搜歌花费了%Cost%";
|
||||
AddMusic = "§d[ALLMusic]§e你点歌花费了%Cost%";
|
||||
NoMoney = "§d[ALLMusic]§c你没有足够的钱";
|
||||
CostFail = "§d[ALLMusic]§c扣钱过程中错误";
|
||||
search = "§d[AllMusic3]§e你搜歌花费了%Cost%";
|
||||
addMusic = "§d[AllMusic3]§e你点歌花费了%Cost%";
|
||||
noMoney = "§d[AllMusic3]§c你没有足够的钱";
|
||||
costFail = "§d[AllMusic3]§c扣钱过程中错误";
|
||||
}
|
||||
|
||||
public static CostObj make() {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class CustomObj {
|
||||
public String Info;
|
||||
public String info;
|
||||
|
||||
public boolean check() {
|
||||
return Info == null;
|
||||
return info == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Info = "自定义音乐";
|
||||
info = "自定义音乐";
|
||||
}
|
||||
|
||||
public static CustomObj make() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class FunObj {
|
||||
public String Rain;
|
||||
public String rain;
|
||||
|
||||
public boolean check() {
|
||||
boolean res = false;
|
||||
if (Rain == null) {
|
||||
if (rain == null) {
|
||||
res = true;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class FunObj {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Rain = "§d[AllMusic]§e天空开始变得湿润";
|
||||
rain = "§d[AllMusic3]§e天空开始变得湿润";
|
||||
}
|
||||
|
||||
public static FunObj make() {
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class HelpAdminObj {
|
||||
public String Reload;
|
||||
public String Next;
|
||||
public String Ban;
|
||||
public String BanPlayer;
|
||||
public String Url;
|
||||
public String Delete;
|
||||
public String AddList;
|
||||
public String ClearList;
|
||||
public String Login;
|
||||
public String Code;
|
||||
public String reload;
|
||||
public String next;
|
||||
public String ban;
|
||||
public String banPlayer;
|
||||
public String url;
|
||||
public String delete;
|
||||
public String addList;
|
||||
public String clearList;
|
||||
public String login;
|
||||
public String code;
|
||||
|
||||
public boolean check() {
|
||||
if (Reload == null)
|
||||
if (reload == null)
|
||||
return true;
|
||||
if (Next == null)
|
||||
if (next == null)
|
||||
return true;
|
||||
if (Ban == null)
|
||||
if (ban == null)
|
||||
return true;
|
||||
if (Url == null)
|
||||
if (url == null)
|
||||
return true;
|
||||
if (Delete == null)
|
||||
if (delete == null)
|
||||
return true;
|
||||
if (AddList == null)
|
||||
if (addList == null)
|
||||
return true;
|
||||
if (ClearList == null)
|
||||
if (clearList == null)
|
||||
return true;
|
||||
if (Code == null)
|
||||
if (code == null)
|
||||
return true;
|
||||
if (BanPlayer == null)
|
||||
if (banPlayer == null)
|
||||
return true;
|
||||
return Login == null;
|
||||
return login == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Reload = "§d[AllMusic]§e使用/music reload 重读配置文件";
|
||||
Next = "§d[AllMusic]§e使用/music next 强制切歌";
|
||||
Ban = "§d[AllMusic]§e使用/music ban [ID] 禁止点这首歌";
|
||||
BanPlayer = "§d[AllMusic]§e使用/music banplayer [ID] 禁止某位玩家点歌";
|
||||
Url = "§d[AllMusic]§e使用/music url [url] 播放一首自定义歌曲";
|
||||
Delete = "§d[AllMusic]§e使用/music delete [序号] 删除队列中的歌曲";
|
||||
AddList = "§d[AllMusic]§e使用/music addlist [歌单ID] 添加歌单到空闲列表";
|
||||
ClearList = "§d[AllMusic]§e使用/music clearlist 清空空闲歌单";
|
||||
Login = "§d[AllMusic]§e使用/music login [验证码] 登录账户";
|
||||
Code = "§d[AllMusic]§e使用/music code 获取短信验证码";
|
||||
reload = "§d[AllMusic3]§e使用/music reload 重读配置文件";
|
||||
next = "§d[AllMusic3]§e使用/music next 强制切歌";
|
||||
ban = "§d[AllMusic3]§e使用/music ban [ID] 禁止点这首歌";
|
||||
banPlayer = "§d[AllMusic3]§e使用/music banplayer [ID] 禁止某位玩家点歌";
|
||||
url = "§d[AllMusic3]§e使用/music url [url] 播放一首自定义歌曲";
|
||||
delete = "§d[AllMusic3]§e使用/music delete [序号] 删除队列中的歌曲";
|
||||
addList = "§d[AllMusic3]§e使用/music addlist [歌单ID] 添加歌单到空闲列表";
|
||||
clearList = "§d[AllMusic3]§e使用/music clearlist 清空空闲歌单";
|
||||
login = "§d[AllMusic3]§e使用/music login [验证码] 登录账户";
|
||||
code = "§d[AllMusic3]§e使用/music code [手机号] 获取短信验证码";
|
||||
}
|
||||
|
||||
public static HelpAdminObj make() {
|
||||
|
||||
@@ -1,62 +1,98 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class HelpNormalObj {
|
||||
public String Head;
|
||||
public String Base;
|
||||
public String Stop;
|
||||
public String List;
|
||||
public String Vote;
|
||||
public String NoMusic;
|
||||
public String Search;
|
||||
public String Select;
|
||||
public String Hud1;
|
||||
public String Hud2;
|
||||
public String Hud3;
|
||||
public String Hud4;
|
||||
public String Hud5;
|
||||
public String head;
|
||||
public String base;
|
||||
public String stop;
|
||||
public String list;
|
||||
public String cancel;
|
||||
public String vote;
|
||||
public String vote1;
|
||||
public String push;
|
||||
public String push1;
|
||||
public String mute;
|
||||
public String search;
|
||||
public String select;
|
||||
public String hud1;
|
||||
public String hud2;
|
||||
public String hud3;
|
||||
public String hud4;
|
||||
public String hud5;
|
||||
public String hud6;
|
||||
public String hud7;
|
||||
public String hud8;
|
||||
public String hud9;
|
||||
public String hud10;
|
||||
|
||||
public boolean check() {
|
||||
if (Head == null)
|
||||
if (head == null)
|
||||
return true;
|
||||
if (Base == null)
|
||||
if (base == null)
|
||||
return true;
|
||||
if (Stop == null)
|
||||
if (stop == null)
|
||||
return true;
|
||||
if (List == null)
|
||||
if (list == null)
|
||||
return true;
|
||||
if (Vote == null)
|
||||
if (cancel == null)
|
||||
return true;
|
||||
if (NoMusic == null)
|
||||
if (vote == null)
|
||||
return true;
|
||||
if (Search == null)
|
||||
if (vote1 == null)
|
||||
return true;
|
||||
if (Select == null)
|
||||
if (push == null)
|
||||
return true;
|
||||
if (Hud1 == null)
|
||||
if (push1 == null)
|
||||
return true;
|
||||
if (Hud2 == null)
|
||||
if (mute == null)
|
||||
return true;
|
||||
if (Hud3 == null)
|
||||
if (search == null)
|
||||
return true;
|
||||
if (Hud4 == null)
|
||||
if (select == null)
|
||||
return true;
|
||||
return Hud5 == null;
|
||||
if (hud1 == null)
|
||||
return true;
|
||||
if (hud2 == null)
|
||||
return true;
|
||||
if (hud3 == null)
|
||||
return true;
|
||||
if (hud4 == null)
|
||||
return true;
|
||||
if (hud6 == null)
|
||||
return true;
|
||||
if (hud7 == null)
|
||||
return true;
|
||||
if (hud8 == null)
|
||||
return true;
|
||||
if (hud9 == null)
|
||||
return true;
|
||||
if (hud10 == null)
|
||||
return true;
|
||||
return hud5 == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Head = "§d[AllMusic]§e帮助手册";
|
||||
Base = "§d[AllMusic]§e使用/music [音乐ID] 来点歌";
|
||||
Stop = "§d[AllMusic]§e使用/music stop 停止播放歌曲";
|
||||
List = "§d[AllMusic]§e使用/music list 查看歌曲队列";
|
||||
Vote = "§d[AllMusic]§e使用/music vote 投票切歌";
|
||||
NoMusic = "§d[AllMusic]§e使用/music nomusic 不再参与点歌";
|
||||
Search = "§d[AllMusic]§e使用/music search [歌名] 搜索歌曲";
|
||||
Select = "§d[AllMusic]§e使用/music select [序列] 选择歌曲";
|
||||
Hud1 = "§d[AllMusic]§e使用/music hud enable [位置] 启用关闭Hud";
|
||||
Hud2 = "§d[AllMusic]§e使用/music hud [位置] [x] [y] 设置某个Hud的位置";
|
||||
Hud3 = "§d[AllMusic]§e使用/music hud picsize [尺寸] 设置图片尺寸";
|
||||
Hud4 = "§d[AllMusic]§e使用/music hud picrotate [开关] 设置图片旋转模式";
|
||||
Hud5 = "§d[AllMusic]§e使用/music hud picrotatespeed [数值] 设置图片旋转速度";
|
||||
head = "§d[AllMusic3]§e帮助手册";
|
||||
base = "§d[AllMusic3]§e使用/music [音乐ID] 来点歌";
|
||||
stop = "§d[AllMusic3]§e使用/music stop 停止播放歌曲";
|
||||
list = "§d[AllMusic3]§e使用/music list 查看歌曲队列";
|
||||
cancel = "§d[AllMusic3]§e使用/music cancel (序号) 取消你的点歌";
|
||||
vote = "§d[AllMusic3]§e使用/music vote 投票切歌";
|
||||
vote1 = "§d[AllMusic3]§e使用/music vote cancel 取消发起的切歌";
|
||||
push = "§d[AllMusic3]§e使用/music push (序号) 投票将歌曲插入到队列头";
|
||||
push1 = "§d[AllMusic3]§e使用/music push cancel 取消发起的插歌";
|
||||
mute = "§d[AllMusic3]§e使用/music mute 不再参与点歌";
|
||||
search = "§d[AllMusic3]§e使用/music search [歌名] 搜索歌曲";
|
||||
select = "§d[AllMusic3]§e使用/music select [序列] 选择歌曲";
|
||||
hud9 = "§d[AllMusic3]§e使用/music hud enable 启用/关闭全部界面";
|
||||
hud10 = "§d[AllMusic3]§e使用/music hud reset 重置全部界面";
|
||||
hud1 = "§d[AllMusic3]§e使用/music hud [位置] enable 启用关闭单一界面";
|
||||
hud2 = "§d[AllMusic3]§e使用/music hud [位置] pos [x] [y] 设置某个界面的位置";
|
||||
hud6 = "§d[AllMusic3]§e使用/music hud [位置] dir [对齐方式] 设置某个界面的对齐方式";
|
||||
hud7 = "§d[AllMusic3]§e使用/music hud [位置] color [颜色HEX] 设置某个界面的颜色";
|
||||
hud8 = "§d[AllMusic3]§e使用/music hud [位置] reset 重置单一界面";
|
||||
hud3 = "§d[AllMusic3]§e使用/music hud pic size [尺寸] 设置图片尺寸";
|
||||
hud4 = "§d[AllMusic3]§e使用/music hud pic rotate [开关] 设置图片旋转模式";
|
||||
hud5 = "§d[AllMusic3]§e使用/music hud pic speed [数值] 设置图片旋转速度";
|
||||
}
|
||||
|
||||
public static HelpNormalObj make() {
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class HelpObj {
|
||||
public HelpNormalObj Normal;
|
||||
public HelpAdminObj Admin;
|
||||
public HelpNormalObj normal;
|
||||
public HelpAdminObj admin;
|
||||
|
||||
public boolean check() {
|
||||
boolean save = false;
|
||||
if (Normal == null || Normal.check()) {
|
||||
if (normal == null || normal.check()) {
|
||||
save = true;
|
||||
Normal = new HelpNormalObj();
|
||||
normal = new HelpNormalObj();
|
||||
}
|
||||
if (Admin == null || Admin.check()) {
|
||||
if (admin == null || admin.check()) {
|
||||
save = true;
|
||||
Admin = new HelpAdminObj();
|
||||
admin = new HelpAdminObj();
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Normal = HelpNormalObj.make();
|
||||
Admin = HelpAdminObj.make();
|
||||
normal = HelpNormalObj.make();
|
||||
admin = HelpAdminObj.make();
|
||||
}
|
||||
|
||||
public static HelpObj make() {
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class HudListObj {
|
||||
public String List;
|
||||
public String Lyric;
|
||||
public String Info;
|
||||
public String All;
|
||||
public String Pic;
|
||||
public String PicRoute;
|
||||
public String PicRouteSpeed;
|
||||
|
||||
public boolean check() {
|
||||
if (List == null)
|
||||
return true;
|
||||
if (Lyric == null)
|
||||
return true;
|
||||
if (Info == null)
|
||||
return true;
|
||||
if (All == null)
|
||||
return true;
|
||||
if (PicRoute == null)
|
||||
return true;
|
||||
if (PicRouteSpeed == null)
|
||||
return true;
|
||||
return Pic == null;
|
||||
}
|
||||
|
||||
public String Get(String data) {
|
||||
if (data.equalsIgnoreCase("List")) {
|
||||
return List;
|
||||
} else if (data.equalsIgnoreCase("Lyric")) {
|
||||
return Lyric;
|
||||
} else if (data.equalsIgnoreCase("Info")) {
|
||||
return Info;
|
||||
} else if (data.equalsIgnoreCase("Pic")) {
|
||||
return Pic;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
List = "待播放列表";
|
||||
Lyric = "歌词";
|
||||
Info = "歌曲信息";
|
||||
Pic = "图片";
|
||||
All = "所有位置";
|
||||
PicRoute = "图片旋转";
|
||||
PicRouteSpeed = "图片旋转速度";
|
||||
}
|
||||
|
||||
public static HudListObj make() {
|
||||
HudListObj obj = new HudListObj();
|
||||
obj.init();
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.objs.enums.HudDirType;
|
||||
|
||||
public class HudNameObj {
|
||||
public String list;
|
||||
public String lyric;
|
||||
public String info;
|
||||
public String all;
|
||||
public String pic;
|
||||
public String picRoute;
|
||||
public String picSpeed;
|
||||
public String enable;
|
||||
public String disable;
|
||||
public String pos1;
|
||||
public String pos2;
|
||||
public String pos3;
|
||||
public String pos4;
|
||||
public String pos5;
|
||||
public String pos6;
|
||||
public String pos7;
|
||||
public String pos8;
|
||||
public String pos9;
|
||||
|
||||
public boolean check() {
|
||||
if (list == null)
|
||||
return true;
|
||||
if (lyric == null)
|
||||
return true;
|
||||
if (info == null)
|
||||
return true;
|
||||
if (all == null)
|
||||
return true;
|
||||
if (picRoute == null)
|
||||
return true;
|
||||
if (picSpeed == null)
|
||||
return true;
|
||||
if (enable == null)
|
||||
return true;
|
||||
if (pos1 == null)
|
||||
return true;
|
||||
if (pos2 == null)
|
||||
return true;
|
||||
if (pos3 == null)
|
||||
return true;
|
||||
if (pos4 == null)
|
||||
return true;
|
||||
if (pos5 == null)
|
||||
return true;
|
||||
if (pos6 == null)
|
||||
return true;
|
||||
if (pos7 == null)
|
||||
return true;
|
||||
if (pos8 == null)
|
||||
return true;
|
||||
if (pos9 == null)
|
||||
return true;
|
||||
return pic == null;
|
||||
}
|
||||
|
||||
public String getHud(HudType data) {
|
||||
if (data == null) {
|
||||
return all;
|
||||
}
|
||||
switch (data) {
|
||||
case PIC:
|
||||
return pic;
|
||||
case INFO:
|
||||
return info;
|
||||
case LYRIC:
|
||||
return lyric;
|
||||
case LIST:
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDir(HudDirType data) {
|
||||
if (data == null) {
|
||||
return all;
|
||||
}
|
||||
switch (data) {
|
||||
case TOP_LEFT:
|
||||
return pos1;
|
||||
case TOP_CENTER:
|
||||
return pos2;
|
||||
case TOP_RIGHT:
|
||||
return pos3;
|
||||
case LEFT:
|
||||
return pos4;
|
||||
case CENTER:
|
||||
return pos5;
|
||||
case RIGHT:
|
||||
return pos6;
|
||||
case BOTTOM_LEFT:
|
||||
return pos7;
|
||||
case BOTTOM_CENTER:
|
||||
return pos8;
|
||||
case BOTTOM_RIGHT:
|
||||
return pos9;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
list = "待播放列表";
|
||||
lyric = "歌词";
|
||||
info = "歌曲信息";
|
||||
pic = "图片";
|
||||
all = "所有位置";
|
||||
picRoute = "图片旋转";
|
||||
picSpeed = "图片旋转速度";
|
||||
enable = "启用";
|
||||
disable = "关闭";
|
||||
pos1 = "左上";
|
||||
pos2 = "上";
|
||||
pos3 = "右上";
|
||||
pos4 = "左";
|
||||
pos5 = "居中";
|
||||
pos6 = "右";
|
||||
pos7 = "左下";
|
||||
pos8 = "下";
|
||||
pos9 = "右下";
|
||||
}
|
||||
|
||||
public static HudNameObj make() {
|
||||
HudNameObj obj = new HudNameObj();
|
||||
obj.init();
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -1,62 +1,70 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class HudObj {
|
||||
public String State;
|
||||
public String Set;
|
||||
public String Reset;
|
||||
public String NoMusic;
|
||||
public String NoList;
|
||||
public String NoLyric;
|
||||
public String PicSize;
|
||||
public String PicRotate;
|
||||
public String PicRotateSpeed;
|
||||
public String Music;
|
||||
public String Lyric;
|
||||
public String List;
|
||||
public String Ktv;
|
||||
public String state;
|
||||
public String set;
|
||||
public String set1;
|
||||
public String set2;
|
||||
public String reset;
|
||||
public String emptyMusic;
|
||||
public String emptyList;
|
||||
public String emptyLyric;
|
||||
public String picSize;
|
||||
public String picRotate;
|
||||
public String picSpeed;
|
||||
public String music;
|
||||
public String lyric;
|
||||
public String list;
|
||||
public String ktv;
|
||||
|
||||
public boolean check() {
|
||||
if (State == null)
|
||||
if (state == null)
|
||||
return true;
|
||||
if (Set == null)
|
||||
if (set == null)
|
||||
return true;
|
||||
if (Reset == null)
|
||||
if (set1 == null)
|
||||
return true;
|
||||
if (NoMusic == null)
|
||||
if (set2 == null)
|
||||
return true;
|
||||
if (NoList == null)
|
||||
if (reset == null)
|
||||
return true;
|
||||
if (NoLyric == null)
|
||||
if (emptyMusic == null)
|
||||
return true;
|
||||
if (PicSize == null)
|
||||
if (emptyList == null)
|
||||
return true;
|
||||
if (Music == null)
|
||||
if (emptyLyric == null)
|
||||
return true;
|
||||
if (Lyric == null)
|
||||
if (picSize == null)
|
||||
return true;
|
||||
if (List == null)
|
||||
if (music == null)
|
||||
return true;
|
||||
if (PicRotate == null)
|
||||
if (lyric == null)
|
||||
return true;
|
||||
if (PicRotateSpeed == null)
|
||||
if (list == null)
|
||||
return true;
|
||||
return Ktv == null;
|
||||
if (picRotate == null)
|
||||
return true;
|
||||
if (picSpeed == null)
|
||||
return true;
|
||||
return ktv == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
State = "§d[AllMusic]§e设置信息位置:%Hud%,状态:%State%";
|
||||
Set = "§d[AllMusic]§e已设置%Hud%的坐标为%x%, %y%";
|
||||
Reset = "§d[AllMusic]§eHud恢复至默认位置";
|
||||
NoMusic = "没有播放的音乐";
|
||||
NoList = "队列中无歌曲";
|
||||
NoLyric = "无歌词";
|
||||
PicSize = "§d[AllMusic]§e设置图片尺寸为%Size%";
|
||||
PicRotate = "§d[AllMusic]§e设置图片旋转为%State%";
|
||||
PicRotateSpeed = "§d[AllMusic]§e设置图片旋转速度为%Size%";
|
||||
Music = "%Name% %AllTime%/%NowTime%\n%Author%\n%Alia%\n%Al%\nby: %Player%";
|
||||
Lyric = "%Lyric%\n%Tlyric%";
|
||||
Ktv = "§e%KLyric%§f%Lyric%§r\n%Tlyric%";
|
||||
List = "播放列表里面有%Size%首歌\n%List%";
|
||||
state = "§d[AllMusic3]§e设置信息位置:%Hud%,状态:%State%";
|
||||
set = "§d[AllMusic3]§e已设置[%Hud%]的坐标为[%x%, %y%]";
|
||||
set1 = "§d[AllMusic3]§e已设置[%Hud%]的对齐方式为[%Dir%]";
|
||||
set2 = "§d[AllMusic3]§e已设置[%Hud%]的颜色为[%Color%]";
|
||||
reset = "§d[AllMusic3]§e界面[%Hud%]恢复至默认位置";
|
||||
emptyMusic = "没有播放的音乐";
|
||||
emptyList = "队列中无歌曲";
|
||||
emptyLyric = "无歌词";
|
||||
picSize = "§d[AllMusic3]§e设置图片尺寸为%Size%";
|
||||
picRotate = "§d[AllMusic3]§e设置图片旋转为%State%";
|
||||
picSpeed = "§d[AllMusic3]§e设置图片旋转速度为%Size%";
|
||||
music = "%Name% %AllTime%/%NowTime%\n%Author%\n%Alia%\n%Al%\nby: %Player%";
|
||||
lyric = "%Lyric%\n%Tlyric%";
|
||||
ktv = "§e%KLyric%§f%Lyric%§r\n%Tlyric%";
|
||||
list = "播放列表里面有%Size%首歌\n%List%";
|
||||
}
|
||||
|
||||
public static HudObj make() {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class ListMusicObj {
|
||||
public String Head;
|
||||
public String Item;
|
||||
public String Get;
|
||||
public String head;
|
||||
public String item;
|
||||
public String get;
|
||||
|
||||
public boolean check() {
|
||||
boolean res = Head == null;
|
||||
if (Item == null)
|
||||
boolean res = head == null;
|
||||
if (item == null)
|
||||
res = true;
|
||||
if (Get == null)
|
||||
if (get == null)
|
||||
res = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Head = "§d[AllMusic]§e队列中有歌曲数:%Count%";
|
||||
Item = "§e%Index%->%MusicName% | %MusicAuthor% | %MusicAl% | %MusicAlia%";
|
||||
Get = "§d[AllMusic]§e歌曲列表%ListName%获取成功";
|
||||
head = "§d[AllMusic3]§e队列中有歌曲数:%Count%";
|
||||
item = "§e%Index%->%MusicName% | %MusicAuthor% | %MusicAl% | %MusicAlia%";
|
||||
get = "§d[AllMusic3]§e歌曲列表%ListName%获取成功";
|
||||
}
|
||||
|
||||
public static ListMusicObj make() {
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class LyricObj {
|
||||
public String Data;
|
||||
public String TData;
|
||||
public String Empty1;
|
||||
public String Empty2;
|
||||
public String Empty3;
|
||||
public String data;
|
||||
public String tdata;
|
||||
public String empty1;
|
||||
public String empty2;
|
||||
public String empty3;
|
||||
|
||||
public boolean check() {
|
||||
if (Data == null)
|
||||
if (data == null)
|
||||
return true;
|
||||
if (TData == null)
|
||||
if (tdata == null)
|
||||
return true;
|
||||
if (Empty1 == null)
|
||||
if (empty1 == null)
|
||||
return true;
|
||||
if (Empty2 == null)
|
||||
if (empty2 == null)
|
||||
return true;
|
||||
return Empty3 == null;
|
||||
return empty3 == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Data = "%Lyric%";
|
||||
TData = "%Lyric%(%TLyric%)";
|
||||
Empty1 = "没有歌词";
|
||||
Empty2 = "没有翻译歌词";
|
||||
Empty3 = "没有KTV歌词";
|
||||
data = "%Lyric%";
|
||||
tdata = "%Lyric%(%TLyric%)";
|
||||
empty1 = "没有歌词";
|
||||
empty2 = "没有翻译歌词";
|
||||
empty3 = "没有KTV歌词";
|
||||
}
|
||||
|
||||
public static LyricObj make() {
|
||||
|
||||
@@ -3,105 +3,117 @@ package coloryr.allmusic.core.objs.message;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
|
||||
public class MessageObj {
|
||||
public MusicPlayObj MusicPlay;
|
||||
public AddMusicObj AddMusic;
|
||||
public PageObj Page;
|
||||
public LyricObj Lyric;
|
||||
public VoteObj Vote;
|
||||
public SearchObj Search;
|
||||
public HudObj Hud;
|
||||
public HudListObj HudList;
|
||||
public CommandObj Command;
|
||||
public CustomObj Custom;
|
||||
public PAPIObj PAPI;
|
||||
public CostObj Cost;
|
||||
public ClickObj Click;
|
||||
public HelpObj Help;
|
||||
public FunObj Fun;
|
||||
public String Version;
|
||||
public MusicPlayObj musicPlay;
|
||||
public AddMusicObj addMusic;
|
||||
public PageObj page;
|
||||
public LyricObj lyric;
|
||||
public VoteObj vote;
|
||||
public PushObj push;
|
||||
public SearchObj search;
|
||||
public HudObj hud;
|
||||
public HudNameObj hudList;
|
||||
public CommandObj command;
|
||||
public CustomObj custom;
|
||||
public PAPIObj papi;
|
||||
public CostObj cost;
|
||||
public ClickObj click;
|
||||
public HelpObj help;
|
||||
public FunObj fun;
|
||||
public CancelObj cancel;
|
||||
public String version;
|
||||
|
||||
public boolean check() {
|
||||
boolean saveConfig = false;
|
||||
if (MusicPlay == null || MusicPlay.check()) {
|
||||
if (musicPlay == null || musicPlay.check()) {
|
||||
saveConfig = true;
|
||||
MusicPlay = MusicPlayObj.make();
|
||||
musicPlay = MusicPlayObj.make();
|
||||
}
|
||||
if (AddMusic == null || AddMusic.check()) {
|
||||
if (addMusic == null || addMusic.check()) {
|
||||
saveConfig = true;
|
||||
AddMusic = AddMusicObj.make();
|
||||
addMusic = AddMusicObj.make();
|
||||
}
|
||||
if (Page == null || Page.check()) {
|
||||
if (page == null || page.check()) {
|
||||
saveConfig = true;
|
||||
Page = PageObj.make();
|
||||
page = PageObj.make();
|
||||
}
|
||||
if (Lyric == null || Lyric.check()) {
|
||||
if (lyric == null || lyric.check()) {
|
||||
saveConfig = true;
|
||||
Lyric = LyricObj.make();
|
||||
lyric = LyricObj.make();
|
||||
}
|
||||
if (Vote == null || Vote.check()) {
|
||||
if (vote == null || vote.check()) {
|
||||
saveConfig = true;
|
||||
Vote = VoteObj.make();
|
||||
vote = VoteObj.make();
|
||||
}
|
||||
if (Search == null || Search.check()) {
|
||||
if (search == null || search.check()) {
|
||||
saveConfig = true;
|
||||
Search = SearchObj.make();
|
||||
search = SearchObj.make();
|
||||
}
|
||||
if (Hud == null || Hud.check()) {
|
||||
if (hud == null || hud.check()) {
|
||||
saveConfig = true;
|
||||
Hud = HudObj.make();
|
||||
hud = HudObj.make();
|
||||
}
|
||||
if (HudList == null || HudList.check()) {
|
||||
if (hudList == null || hudList.check()) {
|
||||
saveConfig = true;
|
||||
HudList = HudListObj.make();
|
||||
hudList = HudNameObj.make();
|
||||
}
|
||||
if (Command == null || Command.check()) {
|
||||
if (command == null || command.check()) {
|
||||
saveConfig = true;
|
||||
Command = CommandObj.make();
|
||||
command = CommandObj.make();
|
||||
}
|
||||
if (Custom == null || Custom.check()) {
|
||||
if (custom == null || custom.check()) {
|
||||
saveConfig = true;
|
||||
Custom = CustomObj.make();
|
||||
custom = CustomObj.make();
|
||||
}
|
||||
if (PAPI == null || PAPI.check()) {
|
||||
if (papi == null || papi.check()) {
|
||||
saveConfig = true;
|
||||
PAPI = PAPIObj.make();
|
||||
papi = PAPIObj.make();
|
||||
}
|
||||
if (Cost == null || Cost.check()) {
|
||||
if (cost == null || cost.check()) {
|
||||
saveConfig = true;
|
||||
Cost = CostObj.make();
|
||||
cost = CostObj.make();
|
||||
}
|
||||
if (Click == null || Click.check()) {
|
||||
if (click == null || click.check()) {
|
||||
saveConfig = true;
|
||||
Click = ClickObj.make();
|
||||
click = ClickObj.make();
|
||||
}
|
||||
if (Help == null || Help.check()) {
|
||||
if (help == null || help.check()) {
|
||||
saveConfig = true;
|
||||
Help = HelpObj.make();
|
||||
help = HelpObj.make();
|
||||
}
|
||||
if (Fun == null || Fun.check()) {
|
||||
if (fun == null || fun.check()) {
|
||||
saveConfig = true;
|
||||
Fun = FunObj.make();
|
||||
fun = FunObj.make();
|
||||
}
|
||||
if (push == null || push.check()) {
|
||||
saveConfig = true;
|
||||
push = PushObj.make();
|
||||
}
|
||||
if (cancel == null || cancel.check()) {
|
||||
saveConfig = true;
|
||||
cancel = CancelObj.make();
|
||||
}
|
||||
return saveConfig;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
MusicPlay = MusicPlayObj.make();
|
||||
AddMusic = AddMusicObj.make();
|
||||
Page = PageObj.make();
|
||||
Lyric = LyricObj.make();
|
||||
Vote = VoteObj.make();
|
||||
Search = SearchObj.make();
|
||||
Hud = HudObj.make();
|
||||
Command = CommandObj.make();
|
||||
HudList = HudListObj.make();
|
||||
Custom = CustomObj.make();
|
||||
PAPI = PAPIObj.make();
|
||||
Cost = CostObj.make();
|
||||
Click = ClickObj.make();
|
||||
Help = HelpObj.make();
|
||||
Fun = FunObj.make();
|
||||
Version = AllMusic.messageVersion;
|
||||
musicPlay = MusicPlayObj.make();
|
||||
addMusic = AddMusicObj.make();
|
||||
page = PageObj.make();
|
||||
lyric = LyricObj.make();
|
||||
vote = VoteObj.make();
|
||||
search = SearchObj.make();
|
||||
hud = HudObj.make();
|
||||
command = CommandObj.make();
|
||||
hudList = HudNameObj.make();
|
||||
custom = CustomObj.make();
|
||||
papi = PAPIObj.make();
|
||||
cost = CostObj.make();
|
||||
click = ClickObj.make();
|
||||
help = HelpObj.make();
|
||||
fun = FunObj.make();
|
||||
push = PushObj.make();
|
||||
cancel = CancelObj.make();
|
||||
version = AllMusic.messageVersion;
|
||||
}
|
||||
|
||||
public static MessageObj make() {
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class MusicPlayObj {
|
||||
public String StopPlay;
|
||||
public String NoMusic;
|
||||
public String Play;
|
||||
public String NoPlay;
|
||||
public ListMusicObj ListMusic;
|
||||
public String NoCanPlay;
|
||||
public String NoPlayMusic;
|
||||
public String Switch;
|
||||
public String AddMusic;
|
||||
public String CheckMusic;
|
||||
public String MusicInfo;
|
||||
public String Trail;
|
||||
public String Cancel;
|
||||
public String stopPlaying;
|
||||
public String emptyPlayingMusic;
|
||||
public String nowPlay;
|
||||
public String emptyPlay;
|
||||
public ListMusicObj listMusic;
|
||||
public String emptyCanPlay;
|
||||
public String mute;
|
||||
public String switchMusic;
|
||||
public String addMusic;
|
||||
public String checkMusic;
|
||||
public String musicInfo;
|
||||
public String trail;
|
||||
public String cancel;
|
||||
|
||||
public boolean check() {
|
||||
boolean res = StopPlay == null;
|
||||
if (NoMusic == null)
|
||||
boolean res = stopPlaying == null;
|
||||
if (emptyPlayingMusic == null)
|
||||
res = true;
|
||||
if (Play == null)
|
||||
if (nowPlay == null)
|
||||
res = true;
|
||||
if (NoPlay == null)
|
||||
if (emptyPlay == null)
|
||||
res = true;
|
||||
if (ListMusic == null || ListMusic.check())
|
||||
if (listMusic == null || listMusic.check())
|
||||
res = true;
|
||||
if (NoCanPlay == null)
|
||||
if (emptyCanPlay == null)
|
||||
res = true;
|
||||
if (NoPlayMusic == null)
|
||||
if (mute == null)
|
||||
res = true;
|
||||
if (Switch == null)
|
||||
if (switchMusic == null)
|
||||
res = true;
|
||||
if (AddMusic == null)
|
||||
if (addMusic == null)
|
||||
res = true;
|
||||
if (CheckMusic == null)
|
||||
if (checkMusic == null)
|
||||
res = true;
|
||||
if (MusicInfo == null)
|
||||
if (musicInfo == null)
|
||||
res = true;
|
||||
if (Trail == null)
|
||||
if (trail == null)
|
||||
res = true;
|
||||
if (Cancel == null)
|
||||
if (cancel == null)
|
||||
res = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
StopPlay = "§d[AllMusic]§e已停止你的音乐播放";
|
||||
NoMusic = "§d[AllMusic]§e无正在播放的歌曲";
|
||||
Play = "§d[AllMusic]§e正在播放:%MusicName% | %MusicAuthor% by:%PlayerName%";
|
||||
NoPlay = "§d[AllMusic]§e队列中无歌曲";
|
||||
ListMusic = ListMusicObj.make();
|
||||
NoCanPlay = "§d[AllMusic]§c无法播放歌曲%MusicID%可能该歌曲为VIP歌曲";
|
||||
NoPlayMusic = "§d[AllMusic]§e你不会再收到点歌了!想要再次参与点歌就点一首歌吧!";
|
||||
Switch = "§d[AllMusic]§e切换到玩家歌曲";
|
||||
AddMusic = "§d[AllMusic]§e音乐列表添加%MusicName% | %MusicAuthor% | %MusicAl% | %MusicAlia%";
|
||||
CheckMusic = "§d[AllMusic]§e正在解析歌曲%MusicID%";
|
||||
MusicInfo = "%MusicName% | %MusicAuthor% | %MusicAl% | %MusicAlia% | by: %PlayerName%";
|
||||
Trail = "§d[AllMusic]§e该音乐为试听音乐";
|
||||
Cancel = "§d[AllMusic]§e播放被取消";
|
||||
stopPlaying = "§d[AllMusic3]§e已停止你的音乐播放";
|
||||
emptyPlayingMusic = "§d[AllMusic3]§e无正在播放的歌曲";
|
||||
nowPlay = "§d[AllMusic3]§e正在播放:%MusicName% | %MusicAuthor% by:%PlayerName%";
|
||||
emptyPlay = "§d[AllMusic3]§e队列中无歌曲";
|
||||
listMusic = ListMusicObj.make();
|
||||
emptyCanPlay = "§d[AllMusic3]§c无法播放歌曲%MusicID%可能该歌曲为VIP歌曲";
|
||||
mute = "§d[AllMusic3]§e你不会再收到点歌了!想要再次参与点歌就点一首歌吧!";
|
||||
switchMusic = "§d[AllMusic3]§e切换到玩家歌曲";
|
||||
addMusic = "§d[AllMusic3]§e音乐列表添加%MusicName% | %MusicAuthor% | %MusicAl% | %MusicAlia%";
|
||||
checkMusic = "§d[AllMusic3]§e正在解析歌曲%MusicID%";
|
||||
musicInfo = "%MusicName% | %MusicAuthor% | %MusicAl% | %MusicAlia% | by: %PlayerName%";
|
||||
trail = "§d[AllMusic3]§e该音乐为试听音乐";
|
||||
cancel = "§d[AllMusic3]§e播放被取消";
|
||||
}
|
||||
|
||||
public static MusicPlayObj make() {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class PAPIObj {
|
||||
public String NoMusic;
|
||||
public String emptyMusic;
|
||||
|
||||
public boolean check() {
|
||||
return NoMusic == null;
|
||||
return emptyMusic == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
NoMusic = "没有播放的音乐";
|
||||
emptyMusic = "没有播放的音乐";
|
||||
}
|
||||
|
||||
public static PAPIObj make() {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class PageObj {
|
||||
public String Choice;
|
||||
public String Next;
|
||||
public String Last;
|
||||
public String choice;
|
||||
public String next;
|
||||
public String last;
|
||||
|
||||
public boolean check() {
|
||||
boolean res = Choice == null;
|
||||
if (Next == null)
|
||||
boolean res = choice == null;
|
||||
if (next == null)
|
||||
res = true;
|
||||
if (Last == null)
|
||||
if (last == null)
|
||||
res = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Choice = "§e%Index%->%MusicName% | %MusicAuthor% | %MusicAl%";
|
||||
Next = "§e[§n点我下一页§r§e]";
|
||||
Last = "§e[§n点我上一页§r§e]";
|
||||
choice = "§e%Index%->%MusicName% | %MusicAuthor% | %MusicAl%";
|
||||
next = "§e[§n点我下一页§r§e]";
|
||||
last = "§e[§n点我上一页§r§e]";
|
||||
}
|
||||
|
||||
public static PageObj make() {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class PushObj {
|
||||
public String noPermission;
|
||||
public String doVote;
|
||||
public String bq;
|
||||
public String bq1;
|
||||
public String bq2;
|
||||
public String agree;
|
||||
public String bqAgree;
|
||||
public String arAgree;
|
||||
public String timeOut;
|
||||
public String doPush;
|
||||
public String noId;
|
||||
public String noId1;
|
||||
public String idErr;
|
||||
public String pushErr;
|
||||
public String cancel;
|
||||
public String err1;
|
||||
public String err2;
|
||||
public String err3;
|
||||
|
||||
public boolean check() {
|
||||
if (noPermission == null)
|
||||
return true;
|
||||
if (doVote == null)
|
||||
return true;
|
||||
if (bq == null)
|
||||
return true;
|
||||
if (bq1 == null)
|
||||
return true;
|
||||
if (bq2 == null)
|
||||
return true;
|
||||
if (agree == null)
|
||||
return true;
|
||||
if (bqAgree == null)
|
||||
return true;
|
||||
if (arAgree == null)
|
||||
return true;
|
||||
if (timeOut == null)
|
||||
return true;
|
||||
if (noId == null)
|
||||
return true;
|
||||
if (noId1 == null)
|
||||
return true;
|
||||
if (idErr == null)
|
||||
return true;
|
||||
if (pushErr == null)
|
||||
return true;
|
||||
if(cancel == null)
|
||||
return true;
|
||||
if (err1 == null)
|
||||
return true;
|
||||
if (err2 == null)
|
||||
return true;
|
||||
if (err3 == null)
|
||||
return true;
|
||||
return doPush == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
noPermission = "§d[AllMusic3]§c你没有权限插歌";
|
||||
doVote = "§d[AllMusic3]§e已发起插歌投票";
|
||||
bq = "§d[AllMusic3]§e%PlayerName%发起了插歌投票,将曲目%MusicName%-%MusicAuthor%调整到下一首播放,%Time%秒后结束,输入/music push 同意插歌。";
|
||||
bq1 = "§d[AllMusic3]§e或者点击 ";
|
||||
bq2 = "§a同意插歌";
|
||||
agree = "§d[AllMusic3]§e你同意插歌";
|
||||
bqAgree = "§d[AllMusic3]§e%PlayerName%同意插歌,共有%Count%名玩家同意插歌。";
|
||||
arAgree = "§d[AllMusic3]§e你已申请插歌";
|
||||
timeOut = "§d[AllMusic3]§e插歌时间结束";
|
||||
doPush = "§d[AllMusic3]§e播放顺序已调整";
|
||||
noId = "§d[AllMusic3]§c没有找到你的点歌";
|
||||
noId1 = "§d[AllMusic3]§c没有找到序号为%Index%的点歌";
|
||||
idErr = "§d[AllMusic3]§c错误的歌曲序号";
|
||||
pushErr = "§d[AllMusic3]§c这首歌已经是下一首播放了";
|
||||
err1 = "§d[AllMusic3]§c你没有发起插歌";
|
||||
err2 = "§d[AllMusic3]§c你发起的插歌已超时";
|
||||
err3 = "§d[AllMusic3]§c发起失败,已经有人发起了插歌投票";
|
||||
cancel = "§d[AllMusic3]§e插歌投票已被发起者取消";
|
||||
}
|
||||
|
||||
public static PushObj make() {
|
||||
PushObj obj = new PushObj();
|
||||
obj.init();
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,46 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class SearchObj {
|
||||
public String NoPer;
|
||||
public String CantSearch;
|
||||
public String Res;
|
||||
public String NoSearch;
|
||||
public String ErrorNum;
|
||||
public String Chose;
|
||||
public String CantNext;
|
||||
public String CantLast;
|
||||
public String StartSearch;
|
||||
public String noPer;
|
||||
public String cantSearch;
|
||||
public String res;
|
||||
public String emptySearch;
|
||||
public String errorNum;
|
||||
public String choice;
|
||||
public String cantNext;
|
||||
public String cantLast;
|
||||
public String startSearch;
|
||||
|
||||
public boolean check() {
|
||||
if (NoPer == null)
|
||||
if (noPer == null)
|
||||
return true;
|
||||
if (CantSearch == null)
|
||||
if (cantSearch == null)
|
||||
return true;
|
||||
if (Res == null)
|
||||
if (res == null)
|
||||
return true;
|
||||
if (NoSearch == null)
|
||||
if (emptySearch == null)
|
||||
return true;
|
||||
if (ErrorNum == null)
|
||||
if (errorNum == null)
|
||||
return true;
|
||||
if (Chose == null)
|
||||
if (choice == null)
|
||||
return true;
|
||||
if (CantNext == null)
|
||||
if (cantNext == null)
|
||||
return true;
|
||||
if (CantLast == null)
|
||||
if (cantLast == null)
|
||||
return true;
|
||||
return StartSearch == null;
|
||||
return startSearch == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
StartSearch = "§d[AllMusic]§e正在排队搜歌";
|
||||
NoPer = "§d[AllMusic]§c你没有权限搜歌";
|
||||
CantSearch = "§d[AllMusic]§c无法搜索歌曲:%Music%";
|
||||
Res = "§d[AllMusic]§e搜索结果";
|
||||
NoSearch = "§d[AllMusic]§c你没有搜索音乐";
|
||||
ErrorNum = "§d[AllMusic]§c请输入正确的序号";
|
||||
Chose = "§d[AllMusic]§e你选择了序号%Num%";
|
||||
CantNext = "§d[AllMusic]§c无法下一页";
|
||||
CantLast = "§d[AllMusic]§c无法上一页";
|
||||
startSearch = "§d[AllMusic3]§e正在排队搜歌";
|
||||
noPer = "§d[AllMusic3]§c你没有权限搜歌";
|
||||
cantSearch = "§d[AllMusic3]§c无法搜索歌曲:%Music%";
|
||||
res = "§d[AllMusic3]§e搜索结果";
|
||||
emptySearch = "§d[AllMusic3]§c你没有搜索音乐";
|
||||
errorNum = "§d[AllMusic3]§c请输入正确的序号";
|
||||
choice = "§d[AllMusic3]§e你选择了序号%Num%";
|
||||
cantNext = "§d[AllMusic3]§c无法下一页";
|
||||
cantLast = "§d[AllMusic3]§c无法上一页";
|
||||
}
|
||||
|
||||
public static SearchObj make() {
|
||||
|
||||
@@ -1,42 +1,66 @@
|
||||
package coloryr.allmusic.core.objs.message;
|
||||
|
||||
public class VoteObj {
|
||||
public String NoPermission;
|
||||
public String DoVote;
|
||||
public String BQ;
|
||||
public String Agree;
|
||||
public String BQAgree;
|
||||
public String ARAgree;
|
||||
public String TimeOut;
|
||||
public String Do;
|
||||
public String noPermission;
|
||||
public String doVote;
|
||||
public String bq;
|
||||
public String bq1;
|
||||
public String bq2;
|
||||
public String agree;
|
||||
public String bqAgree;
|
||||
public String arAgree;
|
||||
public String timeOut;
|
||||
public String voteDone;
|
||||
public String err1;
|
||||
public String err2;
|
||||
public String err3;
|
||||
public String cancel;
|
||||
|
||||
public boolean check() {
|
||||
if (NoPermission == null)
|
||||
if (noPermission == null)
|
||||
return true;
|
||||
if (DoVote == null)
|
||||
if (doVote == null)
|
||||
return true;
|
||||
if (BQ == null)
|
||||
if (bq == null)
|
||||
return true;
|
||||
if (Agree == null)
|
||||
if (bq1 == null)
|
||||
return true;
|
||||
if (BQAgree == null)
|
||||
if (bq2 == null)
|
||||
return true;
|
||||
if (ARAgree == null)
|
||||
if (agree == null)
|
||||
return true;
|
||||
if (TimeOut == null)
|
||||
if (bqAgree == null)
|
||||
return true;
|
||||
return Do == null;
|
||||
if (arAgree == null)
|
||||
return true;
|
||||
if (timeOut == null)
|
||||
return true;
|
||||
if (err1 == null)
|
||||
return true;
|
||||
if (err2 == null)
|
||||
return true;
|
||||
if (err3 == null)
|
||||
return true;
|
||||
if (cancel == null)
|
||||
return true;
|
||||
return voteDone == null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
NoPermission = "§d[AllMusic]§c你没有权限切歌";
|
||||
DoVote = "§d[AllMusic]§e已发起切歌投票";
|
||||
BQ = "§d[AllMusic]§e%PlayerName%发起了切歌投票,%Time%秒后结束,输入/music vote 同意切歌。";
|
||||
Agree = "§d[AllMusic]§e你同意切歌";
|
||||
BQAgree = "§d[AllMusic]§e%PlayerName%同意切歌,共有%Count%名玩家同意切歌。";
|
||||
ARAgree = "§d[AllMusic]§e你已申请切歌";
|
||||
TimeOut = "§d[AllMusic]§e切歌时间结束";
|
||||
Do = "§d[AllMusic]§e已切歌";
|
||||
noPermission = "§d[AllMusic3]§c你没有权限切歌";
|
||||
doVote = "§d[AllMusic3]§e已发起切歌投票";
|
||||
bq = "§d[AllMusic3]§e%PlayerName%发起了切歌投票,%Time%秒后结束,输入/music vote 同意切歌。";
|
||||
bq1 = "§d[AllMusic3]§e或者点击 ";
|
||||
bq2 = "§a同意切歌";
|
||||
agree = "§d[AllMusic3]§e你同意切歌";
|
||||
bqAgree = "§d[AllMusic3]§e%PlayerName%同意切歌,共有%Count%名玩家同意切歌。";
|
||||
arAgree = "§d[AllMusic3]§e你已申请切歌";
|
||||
timeOut = "§d[AllMusic3]§e切歌时间结束";
|
||||
err1 = "§d[AllMusic3]§c你没有发起切歌";
|
||||
err2 = "§d[AllMusic3]§c你发起的切歌已超时";
|
||||
err3 = "§d[AllMusic3]§c已经有人发起了切歌";
|
||||
voteDone = "§d[AllMusic3]§e已切歌";
|
||||
cancel = "§d[AllMusic3]§e切歌投票已被发起者取消";
|
||||
}
|
||||
|
||||
public static VoteObj make() {
|
||||
|
||||
@@ -16,12 +16,12 @@ public class LyricItemObj {
|
||||
return "";
|
||||
String data;
|
||||
if (tlyric != null && !tlyric.isEmpty()) {
|
||||
data = AllMusic.getMessage().Lyric.TData;
|
||||
data = AllMusic.getMessage().lyric.tdata;
|
||||
return data.replace("%Lyric%", lyric)
|
||||
.replace("%TLyric%", tlyric);
|
||||
}
|
||||
|
||||
data = AllMusic.getMessage().Lyric.Data;
|
||||
data = AllMusic.getMessage().lyric.data;
|
||||
return data.replace("%Lyric%", lyric);
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class SongInfoObj {
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
String info = AllMusic.getMessage().MusicPlay.MusicInfo;
|
||||
String info = AllMusic.getMessage().musicPlay.musicInfo;
|
||||
info = info.replace("%MusicName%", name == null ? "" : name)
|
||||
.replace("%MusicAuthor%", author == null ? "" : author)
|
||||
.replace("%MusicAl%", al == null ? "" : al)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package coloryr.allmusic.core.side;
|
||||
|
||||
public class ComType {
|
||||
public static final String lyric = "[Lyric]";
|
||||
public static final String info = "[Info]";
|
||||
public static final String list = "[List]";
|
||||
public static final String play = "[Play]";
|
||||
public static final String img = "[Img]";
|
||||
public static final String stop = "[Stop]";
|
||||
public static final String clear = "[clear]";
|
||||
public static final String pos = "[Pos]";
|
||||
}
|
||||
+33
-10
@@ -1,9 +1,12 @@
|
||||
package coloryr.allmusic.core.side;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ISide {
|
||||
/**
|
||||
* 重载
|
||||
@@ -48,15 +51,6 @@ public abstract class ISide {
|
||||
*/
|
||||
public abstract boolean needPlay();
|
||||
|
||||
|
||||
/**
|
||||
* 发送AllMusic插件信道消息
|
||||
*
|
||||
* @param data 数据
|
||||
* @param player 用户名
|
||||
*/
|
||||
public abstract void send(String data, String player);
|
||||
|
||||
/**
|
||||
* 发送停止指令
|
||||
*/
|
||||
@@ -112,7 +106,7 @@ public abstract class ISide {
|
||||
* 发送歌曲位置信息
|
||||
*
|
||||
* @param player 用户名
|
||||
* @param pos 歌曲位置
|
||||
* @param pos 歌曲位置(毫秒)
|
||||
*/
|
||||
public abstract void sendPos(String player, int pos);
|
||||
|
||||
@@ -130,6 +124,21 @@ public abstract class ISide {
|
||||
*/
|
||||
public abstract void sendHudInfo(String data);
|
||||
|
||||
/**
|
||||
* 发送Hud的位置信息
|
||||
*
|
||||
* @param name 用户名
|
||||
*/
|
||||
public abstract void sendHudPos(String name);
|
||||
|
||||
/**
|
||||
* 发送Hud数据
|
||||
* @param name 用户名
|
||||
* @param pos 位置
|
||||
* @param data 信息
|
||||
*/
|
||||
public abstract void sendHud(String name, HudType pos, String data);
|
||||
|
||||
/**
|
||||
* 发送Hud的歌曲列表数据
|
||||
*
|
||||
@@ -168,6 +177,14 @@ public abstract class ISide {
|
||||
*/
|
||||
public abstract void bq(String data);
|
||||
|
||||
/**
|
||||
* 广播点击消息
|
||||
* @param message 消息
|
||||
* @param end 结尾
|
||||
* @param command 指令
|
||||
*/
|
||||
public abstract void bqRun(String message, String end, String command);
|
||||
|
||||
/**
|
||||
* 在主线程中广播消息
|
||||
*
|
||||
@@ -243,4 +260,10 @@ public abstract class ISide {
|
||||
* 发送BC的ping包
|
||||
*/
|
||||
public abstract void ping();
|
||||
|
||||
/**
|
||||
* 获取玩家列表
|
||||
* @return 玩家列表
|
||||
*/
|
||||
public abstract List<String> getPlayerList();
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
package coloryr.allmusic.core.hud;
|
||||
package coloryr.allmusic.core.sql;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.enums.HudDirType;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
import coloryr.allmusic.core.objs.config.SaveObj;
|
||||
import coloryr.allmusic.core.objs.hud.PosObj;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.sql.*;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Semaphore;
|
||||
@@ -20,25 +22,41 @@ public class DataSql {
|
||||
/**
|
||||
* 创建表用
|
||||
*/
|
||||
private static final String table = "CREATE TABLE \"allmusic\" (\n" +
|
||||
private static final String table = "CREATE TABLE IF NOT EXISTS \"allmusic\" (\n" +
|
||||
" \"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n" +
|
||||
" \"name\" TEXT(20),\n" +
|
||||
" \"info_x\" integer(6),\n" +
|
||||
" \"info_y\" integer(6),\n" +
|
||||
" \"info_color\" integer(20),\n" +
|
||||
" \"info_dir\" integer(6),\n" +
|
||||
" \"info_shadow\" integer(1),\n" +
|
||||
" \"info_enable\" integer(1),\n" +
|
||||
" \"lyric_x\" integer(6),\n" +
|
||||
" \"lyric_y\" integer(6),\n" +
|
||||
" \"lyric_color\" integer(20),\n" +
|
||||
" \"lyric_dir\" integer(6),\n" +
|
||||
" \"lyric_shadow\" integer(1),\n" +
|
||||
" \"lyric_enable\" integer(1),\n" +
|
||||
" \"list_x\" integer(6),\n" +
|
||||
" \"list_y\" integer(6),\n" +
|
||||
" \"list_color\" integer(20),\n" +
|
||||
" \"list_dir\" integer(6),\n" +
|
||||
" \"list_shadow\" integer(1),\n" +
|
||||
" \"list_enable\" integer(1),\n" +
|
||||
" \"pic_x\" integer(6),\n" +
|
||||
" \"pic_y\" integer(6),\n" +
|
||||
" \"pic_dir\" integer(6),\n" +
|
||||
" \"pic_size\" integer(6),\n" +
|
||||
" \"pic_enable\" integer(1),\n" +
|
||||
" \"pic_rotate\" integer(1),\n" +
|
||||
" \"pic_rotate_speed\" integer(6)\n" +
|
||||
");";
|
||||
|
||||
private static final String table1 = "CREATE TABLE IF NOT EXISTS \"allmusic_list\" (\n" +
|
||||
" \"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n" +
|
||||
" \"sid\" TEXT(40)\n" +
|
||||
");";
|
||||
|
||||
/**
|
||||
* 数据库文件
|
||||
*/
|
||||
@@ -60,11 +78,8 @@ public class DataSql {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + sqlFile.getPath());
|
||||
Statement stat = connection.createStatement();
|
||||
ResultSet set = stat.executeQuery("SELECT name FROM sqlite_master WHERE type='table' AND name='allmusic';");
|
||||
if (!set.next()) {
|
||||
set.close();
|
||||
stat.execute(table);
|
||||
}
|
||||
stat.execute(table);
|
||||
stat.execute(table1);
|
||||
stat.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -110,13 +125,16 @@ public class DataSql {
|
||||
init();
|
||||
}
|
||||
Statement stat = connection.createStatement();
|
||||
sql = MessageFormat.format("UPDATE allmusic SET info_x={0},info_y={1},info_enable={2},lyric_x={3},lyric_y={4},lyric_enable={5},list_x={6},list_y={7}, list_enable={8},pic_x={9},pic_y={10},pic_enable={11},pic_size={12},pic_rotate={13},pic_rotate_speed={14} WHERE name=@name",
|
||||
hud.Info.x, hud.Info.y, hud.EnableInfo ? 1 : 0,
|
||||
hud.Lyric.x, hud.Lyric.y, hud.EnableLyric ? 1 : 0,
|
||||
hud.List.x, hud.List.y, hud.EnableList ? 1 : 0,
|
||||
hud.Pic.x, hud.Pic.y, hud.EnablePic ? 1 : 0,
|
||||
hud.PicSize, hud.EnablePicRotate ? 1 : 0,
|
||||
hud.PicRotateSpeed);
|
||||
sql = MessageFormat.format("UPDATE allmusic SET info_x={0},info_y={1},info_color={15},info_dir={16},info_shadow={17},info_enable={2},lyric_x={3},lyric_y={4},lyric_color={18},lyric_dir={19},lyric_shadow={20},lyric_enable={5},list_x={6},list_y={7}, list_color={21},list_dir={22},list_shadow={23},list_enable={8},pic_x={9},pic_y={10},pic_dir={24},pic_enable={11},pic_size={12},pic_rotate={13},pic_rotate_speed={14} WHERE name=@name",
|
||||
hud.info.x, hud.info.y, hud.info.enable ? 1 : 0,
|
||||
hud.lyric.x, hud.lyric.y, hud.lyric.enable ? 1 : 0,
|
||||
hud.list.x, hud.list.y, hud.list.enable ? 1 : 0,
|
||||
hud.pic.x, hud.pic.y, hud.pic.enable ? 1 : 0,
|
||||
hud.pic.color, hud.pic.shadow ? 1 : 0,
|
||||
hud.picRotateSpeed, hud.info.color, hud.info.dir.ordinal(),
|
||||
hud.info.shadow ? 1 : 0, hud.lyric.color, hud.lyric.dir.ordinal(),
|
||||
hud.lyric.shadow ? 1 : 0, hud.list.color, hud.list.dir.ordinal(),
|
||||
hud.list.shadow ? 1 : 0, hud.pic.dir.ordinal());
|
||||
sql = sql.replace("@name", "'" + name + "'");
|
||||
stat.execute(sql);
|
||||
stat.close();
|
||||
@@ -144,14 +162,19 @@ public class DataSql {
|
||||
Statement stat = connection.createStatement();
|
||||
sql = MessageFormat.format("INSERT INTO allmusic (name,info_x,info_y," +
|
||||
"info_enable,lyric_x,lyric_y,lyric_enable,list_x,list_y,list_enable," +
|
||||
"pic_x,pic_y,pic_enable,pic_size,pic_rotate,pic_rotate_speed)" +
|
||||
"VALUES (@name,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14})",
|
||||
hud.Info.x, hud.Info.y, hud.EnableInfo ? 1 : 0,
|
||||
hud.Lyric.x, hud.Lyric.y, hud.EnableLyric ? 1 : 0,
|
||||
hud.List.x, hud.List.y, hud.EnableList ? 1 : 0,
|
||||
hud.Pic.x, hud.Pic.y, hud.EnablePic ? 1 : 0,
|
||||
hud.PicSize, hud.EnablePicRotate ? 1 : 0,
|
||||
hud.PicRotateSpeed);
|
||||
"pic_x,pic_y,pic_enable,pic_size,pic_rotate,pic_rotate_speed," +
|
||||
"info_color,info_dir,info_shadow,lyric_color,lyric_dir," +
|
||||
"lyric_shadow,list_color,list_dir,list_shadow,pic_dir)" +
|
||||
"VALUES (@name,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24})",
|
||||
hud.info.x, hud.info.y, hud.info.enable ? 1 : 0,
|
||||
hud.lyric.x, hud.lyric.y, hud.lyric.enable ? 1 : 0,
|
||||
hud.list.x, hud.list.y, hud.list.enable ? 1 : 0,
|
||||
hud.pic.x, hud.pic.y, hud.pic.enable ? 1 : 0,
|
||||
hud.pic.color, hud.pic.shadow ? 1 : 0,
|
||||
hud.picRotateSpeed, hud.info.color, hud.info.dir.ordinal(),
|
||||
hud.info.shadow ? 1 : 0, hud.lyric.color, hud.lyric.dir.ordinal(),
|
||||
hud.lyric.shadow ? 1 : 0, hud.list.color, hud.list.dir.ordinal(),
|
||||
hud.list.shadow ? 1 : 0, hud.pic.dir.ordinal());
|
||||
sql = sql.replace("@name", "'" + name + "'");
|
||||
stat.execute(sql);
|
||||
stat.close();
|
||||
@@ -167,38 +190,52 @@ public class DataSql {
|
||||
*/
|
||||
private static void readAll() {
|
||||
try {
|
||||
AllMusic.log.info("正在读取数据库所有内容");
|
||||
AllMusic.log.info("正在读取玩家数据");
|
||||
if (connection.isReadOnly() || connection.isClosed()) {
|
||||
init();
|
||||
}
|
||||
Statement stat = connection.createStatement();
|
||||
ResultSet set = stat.executeQuery("SELECT name,info_x,info_y,info_enable,lyric_x,lyric_y,lyric_enable,list_x,list_y,list_enable,pic_x,pic_y,pic_enable,pic_size,pic_rotate,pic_rotate_speed FROM allmusic");
|
||||
ResultSet set = stat.executeQuery("SELECT name,info_x,info_y,info_enable,lyric_x," +
|
||||
"lyric_y,lyric_enable,list_x,list_y,list_enable,pic_x,pic_y,pic_enable,pic_size," +
|
||||
"pic_rotate,pic_rotate_speed,info_color,info_dir,info_shadow,lyric_color," +
|
||||
"lyric_dir,lyric_shadow,list_color,list_dir,list_shadow,pic_dir FROM allmusic");
|
||||
HudDirType[] vas = HudDirType.values();
|
||||
while (set.next()) {
|
||||
String name = set.getString(1);
|
||||
SaveObj obj = new SaveObj();
|
||||
PosObj pos1 = new PosObj();
|
||||
pos1.x = set.getInt(2);
|
||||
pos1.y = set.getInt(3);
|
||||
obj.Info = pos1;
|
||||
obj.EnableInfo = set.getInt(4) == 1;
|
||||
obj.info = pos1;
|
||||
obj.info.enable = set.getInt(4) == 1;
|
||||
PosObj pos2 = new PosObj();
|
||||
pos2.x = set.getInt(5);
|
||||
pos2.y = set.getInt(6);
|
||||
obj.Lyric = pos2;
|
||||
obj.EnableLyric = set.getInt(7) == 1;
|
||||
obj.lyric = pos2;
|
||||
obj.lyric.enable = set.getInt(7) == 1;
|
||||
PosObj pos3 = new PosObj();
|
||||
pos3.x = set.getInt(8);
|
||||
pos3.y = set.getInt(9);
|
||||
obj.List = pos3;
|
||||
obj.EnableList = set.getInt(10) == 1;
|
||||
obj.list = pos3;
|
||||
obj.list.enable = set.getInt(10) == 1;
|
||||
PosObj pos4 = new PosObj();
|
||||
pos4.x = set.getInt(11);
|
||||
pos4.y = set.getInt(12);
|
||||
obj.Pic = pos4;
|
||||
obj.EnablePic = set.getInt(13) == 1;
|
||||
obj.PicSize = set.getInt(14);
|
||||
obj.EnablePicRotate = set.getInt(15) == 1;
|
||||
obj.PicRotateSpeed = set.getInt(16);
|
||||
obj.pic = pos4;
|
||||
obj.pic.enable = set.getInt(13) == 1;
|
||||
obj.pic.color = set.getInt(14);
|
||||
obj.pic.shadow = set.getInt(15) == 1;
|
||||
obj.picRotateSpeed = set.getInt(16);
|
||||
obj.info.color = set.getInt(17);
|
||||
obj.info.dir = vas[set.getInt(18)];
|
||||
obj.info.shadow = set.getInt(19) == 1;
|
||||
obj.lyric.color = set.getInt(20);
|
||||
obj.lyric.dir = vas[set.getInt(21)];
|
||||
obj.lyric.shadow = set.getInt(22) == 1;
|
||||
obj.list.color = set.getInt(23);
|
||||
obj.list.dir = vas[set.getInt(24)];
|
||||
obj.list.shadow = set.getInt(25) == 1;
|
||||
obj.list.dir = vas[set.getInt(26)];
|
||||
HudUtils.add(name, obj);
|
||||
}
|
||||
stat.close();
|
||||
@@ -208,6 +245,63 @@ public class DataSql {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取空闲歌单列表
|
||||
*/
|
||||
private static void readAllList(){
|
||||
try {
|
||||
AllMusic.log.info("正在读取空闲歌单");
|
||||
if (connection.isReadOnly() || connection.isClosed()) {
|
||||
init();
|
||||
}
|
||||
Statement stat = connection.createStatement();
|
||||
ResultSet set = stat.executeQuery("SELECT sid FROM allmusic_list");
|
||||
List<String> list = new ArrayList<>();
|
||||
while (set.next()) {
|
||||
String name = set.getString(1);
|
||||
list.add(name);
|
||||
}
|
||||
stat.close();
|
||||
|
||||
PlayMusic.addIdleList(list);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("数据库读取错误,请删除关闭服务器删除数据库,在启动服务器");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addIdleList(List<String> list) {
|
||||
task(() -> {
|
||||
try {
|
||||
if (connection.isReadOnly() || connection.isClosed()) {
|
||||
init();
|
||||
}
|
||||
String arrayAsString = String.join(",", list);
|
||||
PreparedStatement pstmt = connection.prepareStatement("INSERT INTO allmusic_list (sid) VALUES (?)");
|
||||
pstmt.setString(1, arrayAsString);
|
||||
pstmt.execute();
|
||||
pstmt.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void clearIdleList() {
|
||||
task(() -> {
|
||||
try {
|
||||
if (connection.isReadOnly() || connection.isClosed()) {
|
||||
init();
|
||||
}
|
||||
Statement stat = connection.createStatement();
|
||||
stat.execute("DELETE FROM allmusic_list");
|
||||
stat.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void task(Runnable runnable) {
|
||||
tasks.add(runnable);
|
||||
semaphore.release();
|
||||
@@ -219,6 +313,7 @@ public class DataSql {
|
||||
public static void start() {
|
||||
init();
|
||||
readAll();
|
||||
readAllList();
|
||||
Thread thread = new Thread(DataSql::run);
|
||||
isRun = true;
|
||||
thread.start();
|
||||
@@ -1,42 +1,43 @@
|
||||
package coloryr.allmusic.core.hud;
|
||||
package coloryr.allmusic.core.utils;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.enums.HudPos;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.music.play.LyricSave;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.config.SaveObj;
|
||||
import coloryr.allmusic.core.objs.enums.HudDirType;
|
||||
import coloryr.allmusic.core.objs.hud.PosObj;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.utils.Function;
|
||||
import coloryr.allmusic.core.sql.DataSql;
|
||||
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<>();
|
||||
private static final Map<String, SaveObj> HudList = new ConcurrentHashMap<>();
|
||||
|
||||
public static SaveObj get(String name) {
|
||||
if (!huds.containsKey(name)) {
|
||||
SaveObj obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
huds.put(name, obj);
|
||||
if (!HudList.containsKey(name)) {
|
||||
SaveObj obj = AllMusic.getConfig().defaultHud.copy();
|
||||
HudList.put(name, obj);
|
||||
DataSql.task(() -> DataSql.addUser(name, obj));
|
||||
return obj;
|
||||
}
|
||||
return huds.get(name);
|
||||
return HudList.get(name);
|
||||
}
|
||||
|
||||
public static void add(String name, SaveObj hud) {
|
||||
huds.put(name, hud);
|
||||
HudList.put(name, hud);
|
||||
}
|
||||
|
||||
public static void addAndSave(String name, SaveObj hud) {
|
||||
huds.put(name, hud);
|
||||
HudList.put(name, hud);
|
||||
DataSql.task(() -> DataSql.addUser(name, hud));
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
for (Map.Entry<String, SaveObj> item : huds.entrySet()) {
|
||||
for (Map.Entry<String, SaveObj> item : HudList.entrySet()) {
|
||||
DataSql.addUser(item.getKey(), item.getValue());
|
||||
}
|
||||
}
|
||||
@@ -50,35 +51,33 @@ public class HudUtils {
|
||||
* @param y y
|
||||
* @return 位置数据
|
||||
*/
|
||||
public static PosObj setHudPos(String player, String pos, String x, String y) {
|
||||
public static PosObj setHudPos(String player, HudType pos, String x, String y) {
|
||||
SaveObj obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
HudPos pos1 = HudPos.valueOf(pos);
|
||||
PosObj posOBJ = new PosObj(0, 0);
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
PosObj posOBJ = new PosObj(0, 0, HudDirType.TOP_LEFT, 0xffffff, false, true);
|
||||
if (!Function.isInteger(x) && !Function.isInteger(y))
|
||||
return null;
|
||||
int x1 = Integer.parseInt(x);
|
||||
int y1 = Integer.parseInt(y);
|
||||
|
||||
switch (pos1) {
|
||||
case lyric:
|
||||
posOBJ = obj.Lyric;
|
||||
switch (pos) {
|
||||
case LYRIC:
|
||||
posOBJ = obj.lyric;
|
||||
break;
|
||||
case list:
|
||||
posOBJ = obj.List;
|
||||
case LIST:
|
||||
posOBJ = obj.list;
|
||||
break;
|
||||
case info:
|
||||
posOBJ = obj.Info;
|
||||
case INFO:
|
||||
posOBJ = obj.info;
|
||||
break;
|
||||
case pic:
|
||||
posOBJ = obj.Pic;
|
||||
case PIC:
|
||||
posOBJ = obj.pic;
|
||||
}
|
||||
posOBJ.x = x1;
|
||||
posOBJ.y = y1;
|
||||
|
||||
addAndSave(player, obj);
|
||||
AllMusic.saveConfig();
|
||||
HudUtils.sendHudPos(player);
|
||||
return posOBJ;
|
||||
}
|
||||
@@ -88,8 +87,8 @@ public class HudUtils {
|
||||
*/
|
||||
public static void sendHudListData() {
|
||||
String info;
|
||||
if (PlayMusic.getSize() == 0) {
|
||||
info = AllMusic.getMessage().Hud.NoList;
|
||||
if (PlayMusic.getListSize() == 0) {
|
||||
info = AllMusic.getMessage().hud.emptyList;
|
||||
} else {
|
||||
String now;
|
||||
StringBuilder list = new StringBuilder();
|
||||
@@ -97,11 +96,11 @@ public class HudUtils {
|
||||
if (info1 == null)
|
||||
continue;
|
||||
now = info1.getInfo();
|
||||
if (now.length() > AllMusic.getConfig().MessageLimitSize)
|
||||
now = now.substring(0, AllMusic.getConfig().MessageLimitSize - 1) + "...";
|
||||
if (now.length() > AllMusic.getConfig().messageLimitSize)
|
||||
now = now.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
|
||||
list.append(now).append("\n");
|
||||
}
|
||||
info = AllMusic.getMessage().Hud.List
|
||||
info = AllMusic.getMessage().hud.list
|
||||
.replace("%Size%", String.valueOf(PlayMusic.getList().size()))
|
||||
.replace("%List%", list.toString());
|
||||
}
|
||||
@@ -127,9 +126,9 @@ public class HudUtils {
|
||||
public static void sendHudNowData() {
|
||||
String info;
|
||||
if (PlayMusic.nowPlayMusic == null) {
|
||||
info = AllMusic.getMessage().Hud.NoMusic;
|
||||
info = AllMusic.getMessage().hud.emptyMusic;
|
||||
} else {
|
||||
info = AllMusic.getMessage().Hud.Music
|
||||
info = AllMusic.getMessage().hud.music
|
||||
.replace("%Name%", PlayMusic.nowPlayMusic.getName())
|
||||
.replace("%AllTime%", tranTime(PlayMusic.musicAllTime))
|
||||
.replace("%NowTime%", tranTime(PlayMusic.musicNowTime / 1000))
|
||||
@@ -149,17 +148,17 @@ public class HudUtils {
|
||||
String info;
|
||||
LyricSave obj = PlayMusic.lyric;
|
||||
if (obj == null) {
|
||||
info = AllMusic.getMessage().Hud.NoLyric;
|
||||
info = AllMusic.getMessage().hud.emptyLyric;
|
||||
} else {
|
||||
String lyric = obj.getLyric();
|
||||
String tLyric = obj.getTlyric();
|
||||
String kLyric = obj.getKly();
|
||||
if (!AllMusic.getConfig().KtvMode) {
|
||||
info = AllMusic.getMessage().Hud.Lyric
|
||||
if (!AllMusic.getConfig().ktvMode) {
|
||||
info = AllMusic.getMessage().hud.lyric
|
||||
.replace("%Lyric%", lyric == null ? "" : lyric)
|
||||
.replace("%Tlyric%", tLyric != null ? tLyric : "");
|
||||
} else {
|
||||
info = AllMusic.getMessage().Hud.Ktv
|
||||
info = AllMusic.getMessage().hud.ktv
|
||||
.replace("%Lyric%", lyric != null ? lyric : "")
|
||||
.replace("%KLyric%", kLyric != null ? kLyric : "")
|
||||
.replace("%Tlyric%", tLyric != null ? tLyric : "");
|
||||
@@ -176,61 +175,58 @@ public class HudUtils {
|
||||
* @param pos 输入数据
|
||||
* @return 设置结果
|
||||
*/
|
||||
public static boolean setHudEnable(String player, String pos) {
|
||||
public static boolean setHudEnable(String player, HudType pos) {
|
||||
SaveObj obj = get(player);
|
||||
boolean res = false;
|
||||
if (obj == null) {
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
res = obj.EnableInfo && obj.EnableList && obj.EnableLyric;
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
res = obj.info.enable && obj.list.enable && obj.lyric.enable;
|
||||
} else {
|
||||
if (pos == null) {
|
||||
if (obj.EnableInfo && obj.EnableList && obj.EnableLyric) {
|
||||
obj.EnableInfo = false;
|
||||
obj.EnableList = false;
|
||||
obj.EnableLyric = false;
|
||||
obj.EnablePic = false;
|
||||
if (obj.info.enable && obj.list.enable && obj.lyric.enable) {
|
||||
obj.info.enable = false;
|
||||
obj.list.enable = false;
|
||||
obj.lyric.enable = false;
|
||||
obj.pic.enable = false;
|
||||
} else {
|
||||
obj.EnableInfo = true;
|
||||
obj.EnableList = true;
|
||||
obj.EnableLyric = true;
|
||||
obj.EnablePic = true;
|
||||
obj.info.enable = true;
|
||||
obj.list.enable = true;
|
||||
obj.lyric.enable = true;
|
||||
obj.pic.enable = true;
|
||||
res = true;
|
||||
}
|
||||
} else {
|
||||
HudPos pos1 = HudPos.valueOf(pos);
|
||||
switch (pos1) {
|
||||
case info:
|
||||
obj.EnableInfo = !obj.EnableInfo;
|
||||
switch (pos) {
|
||||
case INFO:
|
||||
obj.info.enable = !obj.info.enable;
|
||||
break;
|
||||
case list:
|
||||
obj.EnableList = !obj.EnableList;
|
||||
case LIST:
|
||||
obj.list.enable = !obj.list.enable;
|
||||
break;
|
||||
case lyric:
|
||||
obj.EnableLyric = !obj.EnableLyric;
|
||||
case LYRIC:
|
||||
obj.lyric.enable = !obj.lyric.enable;
|
||||
break;
|
||||
case pic:
|
||||
obj.EnablePic = !obj.EnablePic;
|
||||
case PIC:
|
||||
obj.pic.enable = !obj.pic.enable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
clearHud(player);
|
||||
addAndSave(player, obj);
|
||||
AllMusic.saveConfig();
|
||||
HudUtils.sendHudPos(player);
|
||||
if (pos == null) {
|
||||
return res;
|
||||
} else {
|
||||
HudPos pos1 = HudPos.valueOf(pos);
|
||||
switch (pos1) {
|
||||
case info:
|
||||
return obj.EnableInfo;
|
||||
case list:
|
||||
return obj.EnableList;
|
||||
case lyric:
|
||||
return obj.EnableLyric;
|
||||
case pic:
|
||||
return obj.EnablePic;
|
||||
switch (pos) {
|
||||
case INFO:
|
||||
return obj.info.enable;
|
||||
case LIST:
|
||||
return obj.list.enable;
|
||||
case LYRIC:
|
||||
return obj.lyric.enable;
|
||||
case PIC:
|
||||
return obj.pic.enable;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -262,14 +258,12 @@ public class HudUtils {
|
||||
try {
|
||||
SaveObj obj = get(player);
|
||||
if (obj == null) {
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
addAndSave(player, obj);
|
||||
AllMusic.saveConfig();
|
||||
}
|
||||
String data = new Gson().toJson(obj);
|
||||
AllMusic.side.send(data, player);
|
||||
AllMusic.side.sendHudPos(player);
|
||||
} catch (Exception e1) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c数据发送发生错误");
|
||||
e1.printStackTrace();
|
||||
}
|
||||
});
|
||||
@@ -281,12 +275,35 @@ public class HudUtils {
|
||||
* @param player 用户名
|
||||
*/
|
||||
public static void reset(String player) {
|
||||
SaveObj obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
SaveObj obj = AllMusic.getConfig().defaultHud.copy();
|
||||
clearHud(player);
|
||||
addAndSave(player, obj);
|
||||
HudUtils.sendHudPos(player);
|
||||
}
|
||||
|
||||
public static void reset(String player, HudType type) {
|
||||
SaveObj obj = AllMusic.getConfig().defaultHud.copy();
|
||||
SaveObj obj1 = get(player);
|
||||
switch (type) {
|
||||
case INFO:
|
||||
obj1.info = obj.info;
|
||||
break;
|
||||
case LIST:
|
||||
obj1.list = obj.list;
|
||||
break;
|
||||
case LYRIC:
|
||||
obj1.lyric = obj.lyric;
|
||||
break;
|
||||
case PIC:
|
||||
obj1.pic = obj.pic;
|
||||
obj1.picRotateSpeed = obj.picRotateSpeed;
|
||||
break;
|
||||
}
|
||||
clearHud(player);
|
||||
addAndSave(player, obj1);
|
||||
HudUtils.sendHudPos(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Hud的图片大小
|
||||
*
|
||||
@@ -297,11 +314,11 @@ public class HudUtils {
|
||||
public static boolean setPicSize(String player, String size) {
|
||||
SaveObj obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
if (!Function.isInteger(size))
|
||||
return false;
|
||||
|
||||
obj.PicSize = Integer.parseInt(size);
|
||||
obj.pic.color = Integer.parseInt(size);
|
||||
|
||||
addAndSave(player, obj);
|
||||
HudUtils.sendHudPos(player);
|
||||
@@ -318,13 +335,13 @@ public class HudUtils {
|
||||
public static boolean setPicRotate(String player, String open) {
|
||||
SaveObj obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
|
||||
obj.EnablePicRotate = Boolean.parseBoolean(open);
|
||||
obj.pic.shadow = Boolean.parseBoolean(open);
|
||||
|
||||
addAndSave(player, obj);
|
||||
HudUtils.sendHudPos(player);
|
||||
return obj.EnablePicRotate;
|
||||
return obj.pic.shadow;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,14 +354,88 @@ public class HudUtils {
|
||||
public static boolean setPicRotateSpeed(String player, String size) {
|
||||
SaveObj obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().DefaultHud.copy();
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
if (!Function.isInteger(size))
|
||||
return false;
|
||||
|
||||
obj.PicRotateSpeed = Integer.parseInt(size);
|
||||
obj.picRotateSpeed = Integer.parseInt(size);
|
||||
|
||||
addAndSave(player, obj);
|
||||
HudUtils.sendHudPos(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static HudDirType setDir(String player, HudType hud, String arg) {
|
||||
HudDirType type = null;
|
||||
try {
|
||||
if (Function.isInteger(arg)) {
|
||||
int index = Integer.parseInt(arg);
|
||||
type = HudDirType.values()[index];
|
||||
} else {
|
||||
type = HudDirType.valueOf(arg);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SaveObj obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
|
||||
switch (hud) {
|
||||
case INFO:
|
||||
obj.info.dir = type;
|
||||
break;
|
||||
case LIST:
|
||||
obj.list.dir = type;
|
||||
break;
|
||||
case LYRIC:
|
||||
obj.lyric.dir = type;
|
||||
break;
|
||||
case PIC:
|
||||
obj.pic.dir = type;
|
||||
break;
|
||||
}
|
||||
|
||||
addAndSave(player, obj);
|
||||
HudUtils.sendHudPos(player);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static boolean setColor(String player, HudType type, String arg) {
|
||||
int color;
|
||||
try {
|
||||
color = Integer.parseInt(arg);
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SaveObj obj = get(player);
|
||||
if (obj == null)
|
||||
obj = AllMusic.getConfig().defaultHud.copy();
|
||||
|
||||
switch (type) {
|
||||
case INFO:
|
||||
obj.info.color = color;
|
||||
break;
|
||||
case LIST:
|
||||
obj.list.color = color;
|
||||
break;
|
||||
case LYRIC:
|
||||
obj.lyric.color = color;
|
||||
break;
|
||||
case PIC:
|
||||
obj.pic.color = color;
|
||||
break;
|
||||
}
|
||||
|
||||
addAndSave(player, obj);
|
||||
HudUtils.sendHudPos(player);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ plugins {
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '6.1.0'
|
||||
}
|
||||
version = "2.19.4"
|
||||
version = "3.0.0"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -10,8 +10,8 @@ public class FunCore {
|
||||
private static final Random random = new Random();
|
||||
|
||||
public static void addMusic() {
|
||||
if (AllMusic.getConfig().FunConfig.Rain) {
|
||||
int rate = AllMusic.getConfig().FunConfig.RainRate;
|
||||
if (AllMusic.getConfig().funConfig.rain) {
|
||||
int rate = AllMusic.getConfig().funConfig.rainRate;
|
||||
boolean rain;
|
||||
if (rate <= 1) {
|
||||
rain = true;
|
||||
@@ -22,7 +22,7 @@ public class FunCore {
|
||||
for (World item : Bukkit.getWorlds()) {
|
||||
item.setStorm(true);
|
||||
}
|
||||
AllMusic.side.bq(AllMusic.getMessage().Fun.Rain);
|
||||
AllMusic.side.bq(AllMusic.getMessage().fun.rain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@ package coloryr.allmusic.side.bukkit;
|
||||
|
||||
import coloryr.allmusic.AllMusicBukkit;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.objs.config.SaveObj;
|
||||
import coloryr.allmusic.core.objs.enums.ComType;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.side.ComType;
|
||||
import coloryr.allmusic.core.side.ISide;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
import coloryr.allmusic.side.bukkit.event.MusicAddEvent;
|
||||
import coloryr.allmusic.side.bukkit.event.MusicPlayEvent;
|
||||
import coloryr.allmusic.side.bukkit.hooks.CitizensNPC;
|
||||
import coloryr.allmusic.side.bukkit.hooks.SpigotApi;
|
||||
import com.google.gson.Gson;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,12 +20,15 @@ import org.bukkit.entity.Player;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SideBukkit extends ISide {
|
||||
private static Class ByteBufC;
|
||||
private static Class UnpooledC;
|
||||
private static Method bufferM;
|
||||
private static Method writeByteM;
|
||||
private static Method writeIntM;
|
||||
private static Method writeBytesM;
|
||||
private static Method arrayM;
|
||||
|
||||
@@ -43,6 +46,7 @@ public class SideBukkit extends ISide {
|
||||
try {
|
||||
arrayM = ByteBufC.getMethod("array");
|
||||
writeByteM = ByteBufC.getMethod("writeByte", int.class);
|
||||
writeIntM = ByteBufC.getMethod("writeInt", int.class);
|
||||
writeBytesM = ByteBufC.getMethod("writeBytes", byte[].class);
|
||||
} catch (NoSuchMethodException e1) {
|
||||
e1.printStackTrace();
|
||||
@@ -66,12 +70,6 @@ public class SideBukkit extends ISide {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void send(String data, String player) {
|
||||
send(Bukkit.getPlayer(player), data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAllPlayer() {
|
||||
return Bukkit.getOnlinePlayers().size();
|
||||
@@ -85,9 +83,14 @@ public class SideBukkit extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableLyric)
|
||||
if (!obj.lyric.enable)
|
||||
continue;
|
||||
send(player, ComType.lyric + data);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.LYRIC);
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词发送出错");
|
||||
@@ -103,9 +106,14 @@ public class SideBukkit extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableInfo)
|
||||
if (!obj.info.enable)
|
||||
continue;
|
||||
send(player, ComType.info + data);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.INFO);
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词信息发送出错");
|
||||
@@ -113,6 +121,62 @@ public class SideBukkit extends ISide {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudPos(String name) {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
if (AllMusic.isOK(name, null, false))
|
||||
return;
|
||||
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.HUD);
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHud(String name, HudType pos, String data) {
|
||||
try {
|
||||
if (pos == HudType.PIC) {
|
||||
return;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (AllMusic.isOK(name, null, true))
|
||||
return;
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
switch (pos) {
|
||||
case INFO:
|
||||
writeByteM.invoke(buf, ComType.INFO.ordinal());
|
||||
break;
|
||||
case LIST:
|
||||
writeByteM.invoke(buf, ComType.LIST.ordinal());
|
||||
break;
|
||||
case LYRIC:
|
||||
writeByteM.invoke(buf, ComType.LYRIC.ordinal());
|
||||
break;
|
||||
}
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudList(String data) {
|
||||
try {
|
||||
@@ -121,9 +185,14 @@ public class SideBukkit extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableList)
|
||||
if (!obj.list.enable)
|
||||
continue;
|
||||
send(player, ComType.list + data);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.LIST);
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲列表发送出错");
|
||||
@@ -137,8 +206,13 @@ public class SideBukkit extends ISide {
|
||||
String Name = player.getName();
|
||||
try {
|
||||
SaveObj obj = HudUtils.get(Name);
|
||||
String data = new Gson().toJson(obj);
|
||||
send(player, data);
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.HUD);
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
|
||||
} catch (Exception e1) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
|
||||
e1.printStackTrace();
|
||||
@@ -170,7 +244,12 @@ public class SideBukkit extends ISide {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (AllMusic.isOK(player.getName(), null, false))
|
||||
continue;
|
||||
send(player, ComType.play + url);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.PLAY);
|
||||
writeString(buf, url);
|
||||
|
||||
send(player, buf);
|
||||
AllMusic.addNowPlayPlayer(player.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -187,7 +266,11 @@ public class SideBukkit extends ISide {
|
||||
return;
|
||||
if (AllMusic.isOK(player, null, false))
|
||||
return;
|
||||
send(ComType.play + url, player);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.PLAY);
|
||||
writeString(buf, url);
|
||||
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -202,9 +285,14 @@ public class SideBukkit extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnablePic)
|
||||
if (!obj.pic.enable)
|
||||
continue;
|
||||
send(player, ComType.img + url);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.IMG);
|
||||
writeString(buf, url);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
@@ -220,7 +308,11 @@ public class SideBukkit extends ISide {
|
||||
return;
|
||||
if (AllMusic.isOK(player1.getName(), null, true))
|
||||
return;
|
||||
send(ComType.img + url, player);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.IMG);
|
||||
writeString(buf, url);
|
||||
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -235,7 +327,11 @@ public class SideBukkit extends ISide {
|
||||
return;
|
||||
if (AllMusic.isOK(player1.getName(), null, true))
|
||||
return;
|
||||
send(ComType.pos + pos, player);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.POS);
|
||||
writeIntM.invoke(buf, pos);
|
||||
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
e.printStackTrace();
|
||||
@@ -246,7 +342,10 @@ public class SideBukkit extends ISide {
|
||||
protected void topSendStop() {
|
||||
try {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
send(player, ComType.stop);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.STOP);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
@@ -260,7 +359,10 @@ public class SideBukkit extends ISide {
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
send(player, ComType.stop);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.STOP);
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -268,9 +370,16 @@ public class SideBukkit extends ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHud(String player) {
|
||||
public void clearHud(String name) {
|
||||
try {
|
||||
send(ComType.clear, player);
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.CLEAR);
|
||||
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
e.printStackTrace();
|
||||
@@ -281,7 +390,10 @@ public class SideBukkit extends ISide {
|
||||
public void clearHud() {
|
||||
try {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
send(player, ComType.clear);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.CLEAR);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
@@ -291,27 +403,32 @@ public class SideBukkit extends ISide {
|
||||
|
||||
@Override
|
||||
public void bq(String data) {
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& data.length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().MessageLimitSize - 1) + "...";
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& data.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getName())) {
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
player.sendMessage(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bqRun(String message, String end, String command) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bqt(String data) {
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& data.length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().MessageLimitSize - 1) + "...";
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& data.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
|
||||
}
|
||||
String finalData = data;
|
||||
Bukkit.getScheduler().runTask(AllMusicBukkit.plugin, () -> {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getName())) {
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
player.sendMessage(finalData);
|
||||
}
|
||||
}
|
||||
@@ -324,7 +441,7 @@ public class SideBukkit extends ISide {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (CitizensNPC.isNPC(player))
|
||||
online--;
|
||||
else if (AllMusic.getConfig().NoMusicPlayer.contains(player.getName())) {
|
||||
else if (AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
online--;
|
||||
}
|
||||
}
|
||||
@@ -374,7 +491,7 @@ public class SideBukkit extends ISide {
|
||||
|
||||
@Override
|
||||
public boolean checkPermission(String player, String permission) {
|
||||
if (AllMusic.getConfig().Admin.contains(player))
|
||||
if (AllMusic.getConfig().adminList.contains(player))
|
||||
return false;
|
||||
Player player1 = Bukkit.getPlayer(player);
|
||||
if (player1 == null)
|
||||
@@ -402,6 +519,11 @@ public class SideBukkit extends ISide {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPlayerList() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
@@ -425,20 +547,15 @@ public class SideBukkit extends ISide {
|
||||
return event.isCancel();
|
||||
}
|
||||
|
||||
private void send(Player players, String data) {
|
||||
private void send(Player players, Object data) {
|
||||
if (players == null)
|
||||
return;
|
||||
try {
|
||||
byte[] bytes = data.getBytes(StandardCharsets.UTF_8);
|
||||
Object buf = bufferM.invoke(null, bytes.length + 1);
|
||||
writeByteM.invoke(buf, 666);
|
||||
writeBytesM.invoke(buf, bytes);
|
||||
|
||||
if (AllMusic.isRun)
|
||||
runTask(() ->
|
||||
{
|
||||
try {
|
||||
players.sendPluginMessage(AllMusicBukkit.plugin, AllMusic.channel, (byte[]) arrayM.invoke(buf));
|
||||
players.sendPluginMessage(AllMusicBukkit.plugin, AllMusic.channel, (byte[]) arrayM.invoke(data));
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -450,4 +567,10 @@ public class SideBukkit extends ISide {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeString(Object buf, String data) throws InvocationTargetException, IllegalAccessException {
|
||||
byte[] temp = data.getBytes(StandardCharsets.UTF_8);
|
||||
writeIntM.invoke(buf, temp.length);
|
||||
writeBytesM.invoke(buf, temp);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
name: AllMusic
|
||||
name: AllMusic3
|
||||
main: coloryr.allmusic.AllMusicBukkit
|
||||
author: Color_yr
|
||||
version: 2.19.4
|
||||
version: 3.0.0
|
||||
softdepend: [PlaceholderAPI, Vault, Essentials, CMI]
|
||||
api-version: 1.13
|
||||
|
||||
commands:
|
||||
music:
|
||||
description: AllMusic
|
||||
usage: §4[AllMusic]§6/music help
|
||||
description: AllMusic3
|
||||
usage: §4[AllMusic3]§6/music help
|
||||
@@ -3,7 +3,7 @@ plugins {
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '6.1.0'
|
||||
}
|
||||
version = "2.19.4"
|
||||
version = "3.0.0"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package coloryr.allmusic.side.bc;
|
||||
|
||||
import coloryr.allmusic.core.command.CommandEX;
|
||||
import coloryr.allmusic.core.command.TabCommand;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.api.plugin.TabExecutor;
|
||||
@@ -17,6 +16,6 @@ public class CommandBC extends Command implements TabExecutor {
|
||||
}
|
||||
|
||||
public Iterable<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
return TabCommand.getTabList(sender.getName(), args);
|
||||
return CommandEX.getTabList(sender.getName(), args);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,13 @@ package coloryr.allmusic.side.bc;
|
||||
|
||||
import coloryr.allmusic.AllMusicBC;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.config.SaveObj;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.side.ComType;
|
||||
import coloryr.allmusic.core.objs.enums.ComType;
|
||||
import coloryr.allmusic.core.side.ISide;
|
||||
import coloryr.allmusic.core.sql.IEconomy;
|
||||
import coloryr.allmusic.side.bc.event.MusicAddEvent;
|
||||
@@ -40,12 +41,12 @@ public class SideBC extends ISide implements IEconomy {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeInt(0);
|
||||
if (PlayMusic.nowPlayMusic == null)
|
||||
out.writeUTF(AllMusic.getMessage().PAPI.NoMusic);
|
||||
out.writeUTF(AllMusic.getMessage().papi.NoMusic);
|
||||
else {
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& PlayMusic.nowPlayMusic.getName().length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& PlayMusic.nowPlayMusic.getName().length() > AllMusic.getConfig().messageLimitSize) {
|
||||
out.writeUTF(PlayMusic.nowPlayMusic.getName()
|
||||
.substring(0, AllMusic.getConfig().MessageLimitSize));
|
||||
.substring(0, AllMusic.getConfig().messageLimitSize));
|
||||
} else {
|
||||
out.writeUTF(PlayMusic.nowPlayMusic.getName());
|
||||
}
|
||||
@@ -87,7 +88,7 @@ public class SideBC extends ISide implements IEconomy {
|
||||
|
||||
out = ByteStreams.newDataOutput();
|
||||
out.writeInt(5);
|
||||
out.writeInt(PlayMusic.getSize());
|
||||
out.writeInt(PlayMusic.getListSize());
|
||||
server.sendData(AllMusic.channelBC, out.toByteArray());
|
||||
|
||||
out = ByteStreams.newDataOutput();
|
||||
@@ -132,11 +133,6 @@ public class SideBC extends ISide implements IEconomy {
|
||||
server.sendData(AllMusic.channelBC, out.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(String data, String player) {
|
||||
send(ProxyServer.getInstance().getPlayer(player), data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAllPlayer() {
|
||||
return ProxyServer.getInstance().getOnlineCount();
|
||||
@@ -149,9 +145,12 @@ public class SideBC extends ISide implements IEconomy {
|
||||
if (ok(player))
|
||||
continue;
|
||||
SaveObj obj = HudUtils.get(player.getName());
|
||||
if (!obj.EnableLyric)
|
||||
if (!obj.lyric.enable)
|
||||
continue;
|
||||
send(player, ComType.lyric + data);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.lyric.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词发送出错");
|
||||
@@ -166,9 +165,12 @@ public class SideBC extends ISide implements IEconomy {
|
||||
if (ok(player))
|
||||
continue;
|
||||
SaveObj obj = HudUtils.get(player.getName());
|
||||
if (!obj.EnableInfo)
|
||||
if (!obj.info.enable)
|
||||
continue;
|
||||
send(player, ComType.info + data);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.info.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词信息发送出错");
|
||||
@@ -184,9 +186,12 @@ public class SideBC extends ISide implements IEconomy {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableList)
|
||||
if (!obj.list.enable)
|
||||
continue;
|
||||
send(player, ComType.list + data);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.list.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲列表发送出错");
|
||||
@@ -200,7 +205,10 @@ public class SideBC extends ISide implements IEconomy {
|
||||
try {
|
||||
SaveObj obj = HudUtils.get(player.getName());
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
send(player, data);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.hud.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
} catch (Exception e1) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
|
||||
e1.printStackTrace();
|
||||
@@ -228,7 +236,10 @@ public class SideBC extends ISide implements IEconomy {
|
||||
String server = player.getServer() == null ? null : player.getServer().getInfo().getName();
|
||||
if (AllMusic.isOK(player.getName(), server, false))
|
||||
continue;
|
||||
send(player, ComType.play + url);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.play.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player, buf);
|
||||
AllMusic.addNowPlayPlayer(player.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -246,7 +257,66 @@ public class SideBC extends ISide implements IEconomy {
|
||||
String server = player1.getServer() == null ? null : player1.getServer().getInfo().getName();
|
||||
if (AllMusic.isOK(player1.getName(), server, false))
|
||||
return;
|
||||
send(ComType.play + url, player);
|
||||
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.play.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudPos(String player) {
|
||||
try {
|
||||
ProxiedPlayer player1 = ProxyServer.getInstance().getPlayer(player);
|
||||
if (player1 == null)
|
||||
return;
|
||||
String server = player1.getServer() == null ? null : player1.getServer().getInfo().getName();
|
||||
if (AllMusic.isOK(player1.getName(), server, false))
|
||||
return;
|
||||
|
||||
SaveObj obj = HudUtils.get(player);
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.hud.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHud(String name, HudType pos, String data) {
|
||||
try {
|
||||
if (pos == HudType.PIC) {
|
||||
return;
|
||||
}
|
||||
ProxiedPlayer player1 = ProxyServer.getInstance().getPlayer(name);
|
||||
if (player1 == null)
|
||||
return;
|
||||
if (ok(player1))
|
||||
return;
|
||||
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
switch (pos) {
|
||||
case INFO:
|
||||
buf.writeByte(ComType.info.ordinal());
|
||||
break;
|
||||
case LIST:
|
||||
buf.writeByte(ComType.list.ordinal());
|
||||
break;
|
||||
case LYRIC:
|
||||
buf.writeByte(ComType.lyric.ordinal());
|
||||
break;
|
||||
}
|
||||
writeString(buf, data);
|
||||
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -261,9 +331,12 @@ public class SideBC extends ISide implements IEconomy {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnablePic)
|
||||
if (!obj.pic.enable)
|
||||
continue;
|
||||
send(player, ComType.img + url);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.img.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
@@ -279,7 +352,10 @@ public class SideBC extends ISide implements IEconomy {
|
||||
return;
|
||||
if (ok(player1))
|
||||
return;
|
||||
send(ComType.img + url, player);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.img.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -294,7 +370,10 @@ public class SideBC extends ISide implements IEconomy {
|
||||
return;
|
||||
if (ok(player1))
|
||||
return;
|
||||
send(ComType.pos + pos, player);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.pos.ordinal());
|
||||
buf.writeInt(pos);
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲位置指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -305,7 +384,9 @@ public class SideBC extends ISide implements IEconomy {
|
||||
protected void topSendStop() {
|
||||
try {
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
send(player, ComType.stop);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.stop.ordinal());
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
@@ -319,7 +400,9 @@ public class SideBC extends ISide implements IEconomy {
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
send(player, ComType.stop);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.stop.ordinal());
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -327,9 +410,14 @@ public class SideBC extends ISide implements IEconomy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHud(String player) {
|
||||
public void clearHud(String name) {
|
||||
try {
|
||||
send(ComType.clear, player);
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.clear.ordinal());
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
e.printStackTrace();
|
||||
@@ -340,8 +428,10 @@ public class SideBC extends ISide implements IEconomy {
|
||||
public void clearHud() {
|
||||
try {
|
||||
Collection<ProxiedPlayer> values = ProxyServer.getInstance().getPlayers();
|
||||
for (ProxiedPlayer players : values) {
|
||||
send(players, ComType.clear);
|
||||
for (ProxiedPlayer player : values) {
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.clear.ordinal());
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
@@ -351,9 +441,9 @@ public class SideBC extends ISide implements IEconomy {
|
||||
|
||||
@Override
|
||||
public void bq(String data) {
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& data.length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().MessageLimitSize - 1) + "...";
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& data.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
|
||||
}
|
||||
TextComponent message = new TextComponent(data);
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
@@ -363,6 +453,19 @@ public class SideBC extends ISide implements IEconomy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bqRun(String message, String end, String command) {
|
||||
TextComponent send = new TextComponent(message);
|
||||
TextComponent endtext = new TextComponent(end);
|
||||
endtext.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
|
||||
send.addExtra(endtext);
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
if (ok(player))
|
||||
continue;
|
||||
player.sendMessage(send);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bqt(String data) {
|
||||
this.bq(data);
|
||||
@@ -372,10 +475,10 @@ public class SideBC extends ISide implements IEconomy {
|
||||
public boolean needPlay() {
|
||||
int online = 0;
|
||||
for (ServerInfo server : ProxyServer.getInstance().getServers().values()) {
|
||||
if (AllMusic.getConfig().NoMusicServer.contains(server.getName()))
|
||||
if (AllMusic.getConfig().muteServer.contains(server.getName()))
|
||||
continue;
|
||||
for (ProxiedPlayer player : server.getPlayers())
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getName()))
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getName()))
|
||||
online++;
|
||||
}
|
||||
return online > 0;
|
||||
@@ -425,7 +528,7 @@ public class SideBC extends ISide implements IEconomy {
|
||||
|
||||
@Override
|
||||
public boolean checkPermission(String player, String permission) {
|
||||
if (AllMusic.getConfig().Admin.contains(player))
|
||||
if (AllMusic.getConfig().adminList.contains(player))
|
||||
return false;
|
||||
ProxiedPlayer player1 = ProxyServer.getInstance().getPlayer(player);
|
||||
if (player1 == null)
|
||||
@@ -476,6 +579,16 @@ public class SideBC extends ISide implements IEconomy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPlayerList() {
|
||||
List<String> list = new ArrayList<>();
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
list.add(player.getName().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
@@ -490,15 +603,11 @@ public class SideBC extends ISide implements IEconomy {
|
||||
return event.isCancel();
|
||||
}
|
||||
|
||||
private void send(ProxiedPlayer players, String data) {
|
||||
private void send(ProxiedPlayer players, ByteBuf data) {
|
||||
if (players == null)
|
||||
return;
|
||||
try {
|
||||
byte[] bytes = data.getBytes(StandardCharsets.UTF_8);
|
||||
ByteBuf buf = Unpooled.buffer(bytes.length + 1);
|
||||
buf.writeByte(666);
|
||||
buf.writeBytes(bytes);
|
||||
runTask(() -> players.sendData(AllMusic.channel, buf.array()));
|
||||
runTask(() -> players.sendData(AllMusic.channel, data.array()));
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
|
||||
e.printStackTrace();
|
||||
@@ -529,7 +638,7 @@ public class SideBC extends ISide implements IEconomy {
|
||||
} while (SendToBackend.containsKey(uuid));
|
||||
|
||||
SendToBackend.put(uuid, -1);
|
||||
String server = AllMusic.getConfig().Economy.Backend;
|
||||
String server = AllMusic.getConfig().economy.backend;
|
||||
Server toServer = null;
|
||||
for (Server connection : TopServers) {
|
||||
if (connection.getInfo().getName().equalsIgnoreCase(server)) {
|
||||
@@ -580,4 +689,10 @@ public class SideBC extends ISide implements IEconomy {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void writeString(ByteBuf buf, String text) {
|
||||
byte[] temp = text.getBytes(StandardCharsets.UTF_8);
|
||||
buf.writeInt(temp.length);
|
||||
buf.writeBytes(temp);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package coloryr.allmusic.side.velocity;
|
||||
|
||||
import coloryr.allmusic.core.command.CommandEX;
|
||||
import coloryr.allmusic.core.command.TabCommand;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
@@ -33,7 +32,7 @@ public class CommandVelocity implements SimpleCommand {
|
||||
if (invocation.source() instanceof Player) {
|
||||
Player player = (Player) invocation.source();
|
||||
String name = player.getUsername();
|
||||
return TabCommand.getTabList(name, args);
|
||||
return CommandEX.getTabList(name, args);
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@@ -2,19 +2,19 @@ package coloryr.allmusic.side.velocity;
|
||||
|
||||
import coloryr.allmusic.AllMusicVelocity;
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
import coloryr.allmusic.core.music.play.PlayMusic;
|
||||
import coloryr.allmusic.core.objs.config.SaveObj;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.side.ComType;
|
||||
import coloryr.allmusic.core.objs.enums.ComType;
|
||||
import coloryr.allmusic.core.side.ISide;
|
||||
import coloryr.allmusic.core.sql.IEconomy;
|
||||
import coloryr.allmusic.side.velocity.event.MusicAddEvent;
|
||||
import coloryr.allmusic.side.velocity.event.MusicPlayEvent;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.gson.Gson;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
@@ -40,12 +40,12 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeInt(0);
|
||||
if (PlayMusic.nowPlayMusic == null)
|
||||
out.writeUTF(AllMusic.getMessage().PAPI.NoMusic);
|
||||
out.writeUTF(AllMusic.getMessage().papi.NoMusic);
|
||||
else {
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& PlayMusic.nowPlayMusic.getName().length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& PlayMusic.nowPlayMusic.getName().length() > AllMusic.getConfig().messageLimitSize) {
|
||||
out.writeUTF(PlayMusic.nowPlayMusic.getName()
|
||||
.substring(0, AllMusic.getConfig().MessageLimitSize));
|
||||
.substring(0, AllMusic.getConfig().messageLimitSize));
|
||||
} else {
|
||||
out.writeUTF(PlayMusic.nowPlayMusic.getName());
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
|
||||
out = ByteStreams.newDataOutput();
|
||||
out.writeInt(5);
|
||||
out.writeInt(PlayMusic.getSize());
|
||||
out.writeInt(PlayMusic.getListSize());
|
||||
server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());
|
||||
|
||||
out = ByteStreams.newDataOutput();
|
||||
@@ -131,13 +131,6 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
server.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(String data, String player) {
|
||||
if (AllMusicVelocity.plugin.server.getPlayer(player).isPresent()) {
|
||||
send(AllMusicVelocity.plugin.server.getPlayer(player).get(), data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAllPlayer() {
|
||||
return AllMusicVelocity.plugin.server.getPlayerCount();
|
||||
@@ -145,20 +138,34 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
|
||||
@Override
|
||||
public void bq(String data) {
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& data.length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().MessageLimitSize - 1) + "...";
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& data.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
|
||||
}
|
||||
Component message = Component.text(data);
|
||||
for (RegisteredServer server : AllMusicVelocity.plugin.server.getAllServers()) {
|
||||
if (AllMusic.getConfig().NoMusicServer.contains(server.getServerInfo().getName()))
|
||||
if (AllMusic.getConfig().muteServer.contains(server.getServerInfo().getName()))
|
||||
continue;
|
||||
for (Player player : server.getPlayersConnected())
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getUsername()))
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getUsername()))
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bqRun(String message, String end, String command) {
|
||||
TextComponent endtext = Component.text(end)
|
||||
.clickEvent(ClickEvent.runCommand(command));
|
||||
TextComponent send = Component.text(message).append(endtext);
|
||||
for (RegisteredServer server : AllMusicVelocity.plugin.server.getAllServers()) {
|
||||
if (AllMusic.getConfig().muteServer.contains(server.getServerInfo().getName()))
|
||||
continue;
|
||||
for (Player player : server.getPlayersConnected())
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getUsername()))
|
||||
player.sendMessage(send);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bqt(String data) {
|
||||
this.bq(data);
|
||||
@@ -171,14 +178,14 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
if (player.getCurrentServer().isPresent()) {
|
||||
continue;
|
||||
}
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getUsername()))
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getUsername()))
|
||||
online++;
|
||||
}
|
||||
for (RegisteredServer server : AllMusicVelocity.plugin.server.getAllServers()) {
|
||||
if (AllMusic.getConfig().NoMusicServer.contains(server.getServerInfo().getName()))
|
||||
if (AllMusic.getConfig().muteServer.contains(server.getServerInfo().getName()))
|
||||
continue;
|
||||
for (Player player : server.getPlayersConnected())
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getUsername()))
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getUsername()))
|
||||
online++;
|
||||
}
|
||||
return online > 0;
|
||||
@@ -188,7 +195,9 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
protected void topSendStop() {
|
||||
try {
|
||||
for (Player player : AllMusicVelocity.plugin.server.getAllPlayers()) {
|
||||
send(player, ComType.stop);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.stop.ordinal());
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
@@ -202,7 +211,9 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
Optional<Player> player = AllMusicVelocity.plugin.server.getPlayer(name);
|
||||
if (!player.isPresent())
|
||||
return;
|
||||
send(player.get(), ComType.stop);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.stop.ordinal());
|
||||
send(player.get(), buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -217,7 +228,10 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
player.getCurrentServer().get().getServerInfo().getName() : null;
|
||||
if (AllMusic.isOK(player.getUsername(), server, false))
|
||||
continue;
|
||||
send(player, ComType.play + url);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.play.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player, buf);
|
||||
AllMusic.addNowPlayPlayer(player.getUsername());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -235,7 +249,10 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
player1.getCurrentServer().get().getServerInfo().getName() : null;
|
||||
if (AllMusic.isOK(player1.getUsername(), server, false))
|
||||
return;
|
||||
send(ComType.play + url, player);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.play.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player1, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
|
||||
@@ -251,9 +268,12 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
continue;
|
||||
String name = player.getUsername();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnablePic)
|
||||
if (!obj.pic.enable)
|
||||
continue;
|
||||
send(player, ComType.img + url);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.img.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
@@ -268,7 +288,10 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
Player player1 = AllMusicVelocity.plugin.server.getPlayer(player).get();
|
||||
if (ok(player1))
|
||||
return;
|
||||
send(ComType.img + url, player);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.img.ordinal());
|
||||
writeString(buf, url);
|
||||
send(player1, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
@@ -283,7 +306,10 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
Player player1 = AllMusicVelocity.plugin.server.getPlayer(player).get();
|
||||
if (ok(player1))
|
||||
return;
|
||||
send(ComType.pos + pos, player);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.pos.ordinal());
|
||||
buf.writeInt(pos);
|
||||
send(player1, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲位置指令发送出错");
|
||||
@@ -298,9 +324,12 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
if (ok(player))
|
||||
continue;
|
||||
SaveObj obj = HudUtils.get(player.getUsername());
|
||||
if (!obj.EnableLyric)
|
||||
if (!obj.lyric.enable)
|
||||
continue;
|
||||
send(player, ComType.lyric + data);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.lyric.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词发送出错");
|
||||
@@ -315,9 +344,12 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
if (ok(player))
|
||||
continue;
|
||||
SaveObj obj = HudUtils.get(player.getUsername());
|
||||
if (!obj.EnableInfo)
|
||||
if (!obj.info.enable)
|
||||
continue;
|
||||
send(player, ComType.info + data);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.info.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词信息发送出错");
|
||||
@@ -325,6 +357,58 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudPos(String name) {
|
||||
try {
|
||||
Optional<Player> player = AllMusicVelocity.plugin.server.getPlayer(name);
|
||||
if (!player.isPresent())
|
||||
return;
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.hud.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player.get(), buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHud(String name, HudType pos, String data) {
|
||||
try {
|
||||
if (pos == HudType.PIC) {
|
||||
return;
|
||||
}
|
||||
Optional<Player> player = AllMusicVelocity.plugin.server.getPlayer(name);
|
||||
if (!player.isPresent())
|
||||
return;
|
||||
|
||||
if (ok(player.get()))
|
||||
return;
|
||||
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
switch (pos) {
|
||||
case INFO:
|
||||
buf.writeByte(ComType.info.ordinal());
|
||||
break;
|
||||
case LIST:
|
||||
buf.writeByte(ComType.list.ordinal());
|
||||
break;
|
||||
case LYRIC:
|
||||
buf.writeByte(ComType.lyric.ordinal());
|
||||
break;
|
||||
}
|
||||
writeString(buf, data);
|
||||
|
||||
send(player.get(), buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudList(String data) {
|
||||
try {
|
||||
@@ -333,9 +417,12 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
continue;
|
||||
String name = player.getUsername();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableList)
|
||||
if (!obj.list.enable)
|
||||
continue;
|
||||
send(player, ComType.list + data);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.list.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲列表发送出错");
|
||||
@@ -345,12 +432,14 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
|
||||
@Override
|
||||
public void sendHudUtilsAll() {
|
||||
for (Player players : AllMusicVelocity.plugin.server.getAllPlayers()) {
|
||||
String Name = players.getUsername();
|
||||
for (Player player : AllMusicVelocity.plugin.server.getAllPlayers()) {
|
||||
try {
|
||||
SaveObj obj = HudUtils.get(Name);
|
||||
String data = new Gson().toJson(obj);
|
||||
send(data, Name);
|
||||
SaveObj obj = HudUtils.get(player.getUsername());
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.hud.ordinal());
|
||||
writeString(buf, data);
|
||||
send(player, buf);
|
||||
} catch (Exception e1) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
|
||||
e1.printStackTrace();
|
||||
@@ -374,9 +463,15 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHud(String player) {
|
||||
public void clearHud(String name) {
|
||||
try {
|
||||
send(ComType.clear, player);
|
||||
Optional<Player> player = AllMusicVelocity.plugin.server.getPlayer(name);
|
||||
if (!player.isPresent())
|
||||
return;
|
||||
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.clear.ordinal());
|
||||
send(player.get(), buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
e.printStackTrace();
|
||||
@@ -387,8 +482,10 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
public void clearHud() {
|
||||
try {
|
||||
Collection<Player> values = AllMusicVelocity.plugin.server.getAllPlayers();
|
||||
for (Player players : values) {
|
||||
send(players, ComType.clear);
|
||||
for (Player player : values) {
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
buf.writeByte(ComType.clear.ordinal());
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词发生出错");
|
||||
@@ -440,7 +537,7 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
@Override
|
||||
public boolean checkPermission(String player, String permission) {
|
||||
try {
|
||||
if (AllMusic.getConfig().Admin.contains(player))
|
||||
if (AllMusic.getConfig().adminList.contains(player))
|
||||
return false;
|
||||
Player player1 = AllMusicVelocity.plugin.server.getPlayer(player).get();
|
||||
player1.hasPermission(permission);
|
||||
@@ -471,6 +568,11 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPlayerList() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
@@ -507,15 +609,11 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
}
|
||||
}
|
||||
|
||||
private void send(Player players, String data) {
|
||||
private void send(Player players, ByteBuf data) {
|
||||
if (players == null)
|
||||
return;
|
||||
try {
|
||||
byte[] bytes = data.getBytes(StandardCharsets.UTF_8);
|
||||
ByteBuf buf = Unpooled.buffer(bytes.length + 1);
|
||||
buf.writeByte(666);
|
||||
buf.writeBytes(bytes);
|
||||
runTask(() -> players.sendPluginMessage(AllMusicVelocity.channel, buf.array()));
|
||||
runTask(() -> players.sendPluginMessage(AllMusicVelocity.channel, data.array()));
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
|
||||
e.printStackTrace();
|
||||
@@ -547,7 +645,7 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
} while (SendToBackend.containsKey(uuid));
|
||||
|
||||
SendToBackend.put(uuid, -1);
|
||||
String server = AllMusic.getConfig().Economy.Backend;
|
||||
String server = AllMusic.getConfig().economy.backend;
|
||||
ServerConnection toServer = null;
|
||||
for (ServerConnection connection : TopServers) {
|
||||
if (connection.getServerInfo().getName().equalsIgnoreCase(server)) {
|
||||
@@ -598,4 +696,10 @@ public class SideVelocity extends ISide implements IEconomy {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void writeString(ByteBuf buf, String text) {
|
||||
byte[] temp = text.getBytes(StandardCharsets.UTF_8);
|
||||
buf.writeInt(temp.length);
|
||||
buf.writeBytes(temp);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
name: AllMusic
|
||||
main: coloryr.allmusic.AllMusicBC
|
||||
author: Color_yr
|
||||
version: 2.19.4
|
||||
version: 3.0.0
|
||||
Reference in new issue
Block a user