forked from M3isdpr/fix-protocol-version
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
143 lines (122 loc) · 5.22 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
plugins {
kotlin("jvm") version "1.8.22"
kotlin("plugin.serialization") version "1.8.22"
id("net.mamoe.mirai-console") version "2.15.0"
id("me.him188.maven-central-publish") version "1.0.0-dev-3"
}
group = "xyz.cssxsh.mirai"
version = "1.11.1"
mavenCentralPublish {
useCentralS01()
singleDevGithubProject("cssxsh", "fix-protocol-version")
licenseFromGitHubProject("AGPL-3.0")
workingDir = System.getenv("PUBLICATION_TEMP")?.let { file(it).resolve(projectName) }
?: buildDir.resolve("publishing-tmp")
publication {
artifact(tasks["buildPlugin"])
}
}
repositories {
mavenCentral()
maven("https://repo.mirai.mamoe.net/snapshots")
}
dependencies {
testImplementation(kotlin("test"))
//
implementation(platform("net.mamoe:mirai-bom:2.15.0"))
compileOnly("net.mamoe:mirai-core")
compileOnly("net.mamoe:mirai-core-utils")
compileOnly("net.mamoe:mirai-console-compiler-common")
testImplementation("net.mamoe:mirai-core-mock")
testImplementation("net.mamoe:mirai-logging-slf4j")
//
implementation("org.asynchttpclient:async-http-client:3.0.0.Beta2")
//
implementation(platform("org.slf4j:slf4j-parent:2.0.7"))
testImplementation("org.slf4j:slf4j-simple")
//
implementation(platform("io.netty:netty-bom:4.1.96.Final"))
}
kotlin {
explicitApi()
}
mirai {
coreVersion = "2.15.0"
consoleVersion = "2.15.0"
}
tasks {
test {
useJUnitPlatform()
}
register("copyConsoleRuntime") {
group = "mirai"
val folder = file("run/console")
val libs = folder.resolve("libs")
libs.mkdirs()
val plugins = folder.resolve("plugins")
plugins.mkdirs()
doLast {
configurations.getByName("testConsoleRuntime").resolve().forEach { lib ->
val dest = libs.resolve(lib.name)
dest.delete()
lib.copyTo(dest, true)
}
buildDir.resolve("mirai/fix-protocol-version-${version}.mirai2.jar").let { plugin ->
val dest = plugins.resolve(plugin.name)
dest.delete()
plugin.copyTo(dest, true)
}
uri("https://raw.githubusercontent.com/RomiChan/protocol-versions/master/android_pad.json").toURL().let {
folder.resolve("android_pad.json").writeBytes(it.readBytes())
}
"""
@echo off
setlocal
set JAVA_BINARY="java"
if exist "java-home" set JAVA_BINARY=".\java-home\bin\java.exe"
%JAVA_BINARY% -version
%JAVA_BINARY% -D"file.encoding=utf-8" -cp "./libs/*" "net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader"
set EL=%ERRORLEVEL%
if %EL% NEQ 0 (
echo Process exited with %EL%
pause
)
""".trimIndent().let {
folder.resolve("start.cmd").writeText(it)
}
"""
java -D"file.encoding=utf-8" -cp "./libs/*" net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader
""".trimIndent().let {
folder.resolve("start.sh").writeText(it)
}
"""
登陆协议选 ANDROID_PAD
例如
login 123456 password ANDROID_PAD
原理是回退到风控较轻的 旧版本协议 8.8.88,顺便这个 8.8.88 的信息实际上是 ANDROID_PHONE 的,所以会顶号
这是独立的开发版本整合包,不能替换 mcl 的文件来使用
如果出现 'java' 不是内部或外部命令,也不是可运行的程序
说明你没有安装好 Java,你可以选择本地补充安装
本地补充安装(Windows):
自行二选一下载,然后解压全部文件 到 start.cmd 同目录,并将 jdk-17.0.7+7-jre 重命名为 java-home
windows x64 版本
https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jre/x64/windows/OpenJDK17U-jre_x64_windows_hotspot_17.0.7_7.zip
windows x86 版本
https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jre/x32/windows/OpenJDK17U-jre_x86-32_windows_hotspot_17.0.7_7.zip
目录结构如下
├───java-home (本地java目录,注意要解压全部文件,这里仅列出部分目录结构)
│ └───bin
│ └───java.exe
├───start.cmd (WIN启动脚本)
├───start.sh (Linux/MACOS启动脚本)
├───libs (库目录,里面有mirai本体)
├───logs (日志目录,里面有日志文件)
├───plugins (插件目录)
└───android_pad.json (协议版本信息)
整合包 by https://github.com/cssxsh
""".trimIndent().let {
folder.resolve("README.txt").writeText(it)
}
}
}
}