mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-25 19:14:31 +00:00
up
This commit is contained in:
1 parent
ff429c3e50
commit
0de289b56b
7 files changed
+118
-71
No files matched your search
@@ -72,12 +72,12 @@ Forge/Fabric/NeoForge类服务器
|
||||
如果登录失效,请删除`cookie.json`再打`/music reload`再重新登录
|
||||
|
||||
## 构建
|
||||
**仅支持Windows系统**
|
||||
**需要在Windows系统下**
|
||||
安装JDK21
|
||||
|
||||
1. 运行link.cmd
|
||||
2. 打开你想要的工程
|
||||
3. grdele build
|
||||
4. 在根目录的lib文件夹获取jar
|
||||
打开cmd执行`build.cmd`或者直接双击`build.cmd`
|
||||
|
||||
选择构建项目
|
||||
|
||||
## PAPI变量
|
||||
> %allmusic_now_music_name% 歌曲名字
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
:: 版本列表
|
||||
set "PROJECTS[0]=forge_1_7_10"
|
||||
set "PROJECTS[1]=forge_1_12_2"
|
||||
set "PROJECTS[2]=forge_1_16_5"
|
||||
set "PROJECTS[3]=forge_1_18_2"
|
||||
set "PROJECTS[4]=forge_1_19_2"
|
||||
set "PROJECTS[5]=forge_1_20"
|
||||
set "PROJECTS[6]=fabric_1_16_5"
|
||||
set "PROJECTS[7]=fabric_1_18_2"
|
||||
set "PROJECTS[8]=fabric_1_19_2"
|
||||
set "PROJECTS[9]=fabric_1_19_3"
|
||||
set "PROJECTS[10]=fabric_1_20"
|
||||
set "PROJECTS[11]=fabric_1_20_2"
|
||||
set "PROJECTS[12]=fabric_1_20_6"
|
||||
set "PROJECTS[13]=fabric_1_21"
|
||||
set "PROJECTS[14]=fabric_1_21_4"
|
||||
set "PROJECTS[15]=fabric_1_21_5"
|
||||
set "PROJECTS[16]=neoforge_1_20_4"
|
||||
set "PROJECTS[17]=neoforge_1_20_6"
|
||||
set "PROJECTS[18]=neoforge_1_21"
|
||||
set "PROJECTS[19]=neoforge_1_21_4"
|
||||
set "PROJECTS[20]=neoforge_1_21_5"
|
||||
set "PROJECTS[21]=folia"
|
||||
set "PROJECTS[22]=server"
|
||||
set "PROJECTS[23]=server_top"
|
||||
|
||||
set /a ARRAY_LENGTH=23
|
||||
|
||||
cls
|
||||
|
||||
set "LINK_SCRIPT=link.cmd"
|
||||
echo 正在执行预处理脚本: %LINK_SCRIPT%
|
||||
call "%LINK_SCRIPT%" || (
|
||||
echo 预处理脚本失败,退出编译流程
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:menu
|
||||
cls
|
||||
echo AllMusic服务器编译
|
||||
echo 选择需要构建的版本:
|
||||
echo ----------------------------
|
||||
|
||||
:: 生成菜单选项
|
||||
for /L %%i in (0,1,%ARRAY_LENGTH%) do (
|
||||
call echo [%%i] - %%PROJECTS[%%i]%%
|
||||
)
|
||||
echo ----------------------------
|
||||
echo 请输入要编译的项目编号 (0-%ARRAY_LENGTH%):
|
||||
set /p SELECTION=?
|
||||
|
||||
:: 验证输入是否为数字
|
||||
if not defined SELECTION (
|
||||
echo 错误:未输入编号
|
||||
pause
|
||||
goto :menu
|
||||
)
|
||||
if not "%SELECTION%" == "" (
|
||||
set /a SELECTION=%SELECTION%
|
||||
if %SELECTION% LSS 0 (
|
||||
echo 错误:输入不能小于0
|
||||
pause
|
||||
goto :menu
|
||||
)
|
||||
if %SELECTION% GEQ %ARRAY_LENGTH%+1 (
|
||||
echo 错误:输入超过最大索引%ARRAY_LENGTH%
|
||||
pause
|
||||
goto :menu
|
||||
)
|
||||
)
|
||||
|
||||
:: 获取选定路径并拆分盘符/路径
|
||||
call set "SELECTED_PATH=%%PROJECTS[%SELECTION%]%%"
|
||||
|
||||
:: 检查路径存在性
|
||||
if not exist "%SELECTED_PATH%" (
|
||||
echo 错误:路径不存在 - %SELECTED_PATH%
|
||||
pause
|
||||
goto :menu
|
||||
)
|
||||
|
||||
:: 执行目录切换
|
||||
cd /D "%SELECTED_PATH%"
|
||||
|
||||
:: 显示当前路径并执行编译
|
||||
echo 当前工作目录:
|
||||
cd
|
||||
echo 正在执行Gradle编译...
|
||||
call gradlew build
|
||||
|
||||
:: 编译结果处理
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo 编译成功!生成位置:build\libs
|
||||
) else (
|
||||
echo 编译失败,请检查错误信息
|
||||
)
|
||||
pause
|
||||
|
||||
goto :menu
|
||||
+7
-18
@@ -13,7 +13,6 @@ import com.coloryr.allmusic.server.core.side.BaseSide;
|
||||
import com.coloryr.allmusic.server.core.side.IMyLogger;
|
||||
import com.coloryr.allmusic.server.core.sql.DataSql;
|
||||
import com.coloryr.allmusic.server.core.sql.IEconomy;
|
||||
import com.coloryr.allmusic.server.core.utils.Logs;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
@@ -336,18 +335,13 @@ public class AllMusic {
|
||||
* 停止插件
|
||||
*/
|
||||
public static void stop() {
|
||||
try {
|
||||
PlayMusic.clearVote();
|
||||
PlayMusic.clearPush();
|
||||
Logs.stop();
|
||||
side.sendStop();
|
||||
MusicSearch.stop();
|
||||
PlayMusic.stop();
|
||||
PlayRuntime.stop();
|
||||
DataSql.stop();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PlayMusic.clearVote();
|
||||
PlayMusic.clearPush();
|
||||
side.sendStop();
|
||||
MusicSearch.stop();
|
||||
PlayMusic.stop();
|
||||
PlayRuntime.stop();
|
||||
DataSql.stop();
|
||||
log.info("§d[AllMusic3]§2§e已停止,感谢使用");
|
||||
}
|
||||
|
||||
@@ -455,8 +449,6 @@ public class AllMusic {
|
||||
messageFile = new File(file, "message.json");
|
||||
if (cookieFile == null)
|
||||
cookieFile = new File(file, "cookie.json");
|
||||
if (Logs.file == null)
|
||||
Logs.file = new File(file, "logs.log");
|
||||
if (DataSql.sqlFile == null)
|
||||
DataSql.sqlFile = new File(file, "data.db");
|
||||
if (!configFile.exists()) {
|
||||
@@ -468,9 +460,6 @@ public class AllMusic {
|
||||
if (!cookieFile.exists()) {
|
||||
cookieFile.createNewFile();
|
||||
}
|
||||
if (!Logs.file.exists()) {
|
||||
Logs.file.createNewFile();
|
||||
}
|
||||
loadConfig();
|
||||
isRun = true;
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -17,7 +17,6 @@ import com.coloryr.allmusic.server.core.objs.message.PAL;
|
||||
import com.coloryr.allmusic.server.core.objs.music.SearchPageObj;
|
||||
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
|
||||
import com.coloryr.allmusic.server.core.sql.DataSql;
|
||||
import com.coloryr.allmusic.server.core.utils.Logs;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -117,8 +116,7 @@ public class APIMain {
|
||||
TrialInfoObj obj = AllMusic.gson.fromJson(res.data, TrialInfoObj.class);
|
||||
return obj.getUrl();
|
||||
} catch (Exception e) {
|
||||
Logs.logWrite(res.data);
|
||||
AllMusic.log.warning("§d[AllMusic3]§c播放连接解析错误");
|
||||
AllMusic.log.warning("§d[AllMusic3]§c播放连接解析错误:" + res.data);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.coloryr.allmusic.server.core.objs.music.MusicObj;
|
||||
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
|
||||
import com.coloryr.allmusic.server.core.sql.DataSql;
|
||||
import com.coloryr.allmusic.server.core.utils.HudUtils;
|
||||
import com.coloryr.allmusic.server.core.utils.Logs;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.net.URL;
|
||||
@@ -258,7 +257,7 @@ public class PlayMusic {
|
||||
.replace(PAL.musicId, id);
|
||||
AllMusic.side.sendMessageTask(sender, text);
|
||||
}
|
||||
Logs.logWrite("player:" + player + " add:" + id);
|
||||
AllMusic.log.info("玩家:" + player + " 点歌:" + id);
|
||||
try {
|
||||
SongInfoObj info = AllMusic.getMusicApi().getMusic(id, player, isList);
|
||||
if (info == null) {
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.coloryr.allmusic.server.core.utils;
|
||||
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Date;
|
||||
|
||||
public class Logs {
|
||||
private static final Date date = new Date();
|
||||
public static File file;
|
||||
private static FileWriter fw;
|
||||
private static PrintWriter pw;
|
||||
|
||||
public static void logWrite(String text) {
|
||||
try {
|
||||
if (fw == null)
|
||||
fw = new FileWriter(file, true);
|
||||
String year = String.format("%tF", date);
|
||||
String time = String.format("%tT", date);
|
||||
String write = "[" + year + "]" + "[" + time + "]" + text;
|
||||
if (pw == null)
|
||||
pw = new PrintWriter(fw);
|
||||
pw.println(write);
|
||||
pw.flush();
|
||||
fw.flush();
|
||||
|
||||
} catch (IOException e) {
|
||||
AllMusic.log.warning("§c日志文件写入失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void stop() throws IOException {
|
||||
if (fw != null)
|
||||
pw.close();
|
||||
if (fw != null)
|
||||
fw.close();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user