Skip to content

Commit fceb872

Browse files
authored
Merge pull request #2 from 3944Realms/develop
Merge remote-tracking branch 'main/develop' into develop
2 parents 9e3050e + 1173d34 commit fceb872

File tree

66 files changed

+2166
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2166
-73
lines changed

.gitattributes

Whitespace-only changes.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ bin/
4242
.DS_Store
4343

4444
/output/
45+
/sc/

.idea/intellij-javadocs-4.0.1.xml

Lines changed: 204 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ buildscript {
99
}
1010
plugins {
1111
id 'java'
12+
id 'maven-publish'
1213
id 'com.github.johnrengelman.shadow' version '8.1.1'
1314
}
1415

@@ -25,20 +26,28 @@ dependencies {
2526
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
2627
implementation group: 'com.google.guava', name: 'guava', version: '33.3.0-jre'
2728
implementation group: 'io.netty', name: 'netty-all', version: '4.1.109.Final'
28-
implementation 'io.netty:netty-codec-http:4.1.109.Final'
29-
implementation 'io.netty:netty-transport:4.1.109.Final'
30-
implementation 'io.netty:netty-common:4.1.117.Final'
3129
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
3230
testImplementation platform('org.junit:junit-bom:5.10.0')
3331
testImplementation 'org.junit.jupiter:junit-jupiter'
3432
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.16'
3533
}
3634
shadowJar {
3735
destinationDirectory = file('output')
36+
relocate 'io.netty', 'com.r3944realms.shadow.netty'
37+
relocate 'com.google', 'com.r3944realms.shadow.google'
38+
relocate 'org.apache.commons', 'com.r3944realms.shadow.apache.commons'
39+
relocate 'org.slf4j', 'com.r3944realms.shadow.slf4j'
40+
// 关键:合并服务文件并重写模块描述符
41+
mergeServiceFiles()
3842
}
3943
test {
4044
useJUnitPlatform()
4145
}
46+
jar {
47+
manifest.attributes([
48+
"FMLModType": "GAMELIBRARY"
49+
])
50+
}
4251
tasks.register('proguard', proguard.gradle.ProGuardTask) {
4352
dependsOn shadowJar // 确保先构建 Shadow JAR 再混淆‌:ml-citation{ref="2,3" data="citationList"}
4453
configuration files('proguard.pro')
@@ -62,3 +71,51 @@ tasks.register('proguard', proguard.gradle.ProGuardTask) {
6271

6372
outjars(layout.buildDirectory.file("libs/${project.name}-obfused.jar"))
6473
}
74+
// 打包sourcesJar任务
75+
tasks.register('sourcesJar', Jar) {
76+
dependsOn classes
77+
78+
from sourceSets.main.allSource
79+
}
80+
81+
// 打包javadocJar任务
82+
tasks.register('javadocJar', Jar) {
83+
dependsOn javadoc
84+
85+
from javadoc.destinationDir
86+
}
87+
88+
// 解决javadoc打包乱码
89+
javadoc {
90+
options {
91+
encoding "UTF-8"
92+
charSet 'UTF-8'
93+
author true
94+
version true
95+
title "DG_LAB"
96+
}
97+
}
98+
99+
publishing {
100+
publications {
101+
mavenJava(MavenPublication) {
102+
groupId project.group
103+
artifactId project.name
104+
version project.version
105+
from components.java
106+
artifact sourcesJar
107+
artifact javadocJar
108+
}
109+
}
110+
111+
repositories {
112+
maven {
113+
name "xqsw"
114+
url "https://maven.xiaobuawa.top/"
115+
credentials {
116+
username project.findProperty("MAVEN_REPO_USER") ?: "" // 仓库发布用户名
117+
password project.findProperty("MAVEN_REPO_PASS") ?: "" // 仓库发布用户密码
118+
}
119+
}
120+
}
121+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22
project_group ='com.r3944realms.dg_lab'
3-
project_version=2.0.0.5
3+
project_version=2.0.1.7

sc/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MAVEN_REPO_USER=xiaobuawa
2+
MAVEN_REPO_PASS=xiaobuawa

src/main/java/com/r3944realms/dg_lab/DgLab.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
import io.netty.handler.logging.LogLevel;
44
import io.netty.handler.logging.LoggingHandler;
55

6+
/**
7+
* The type Dg lab.
8+
*/
69
public class DgLab {
10+
/**
11+
* The constant LOGGING_HANDLER.
12+
*/
713
public static LoggingHandler LOGGING_HANDLER = new LoggingHandler(LogLevel.DEBUG);
814

915
/**
16+
* Instantiates a new Dg lab.
17+
*
1018
* @param level Netty日志级别()
1119
*/
1220
public DgLab(LogLevel level) {

src/main/java/com/r3944realms/dg_lab/api/dataType/PowerBoxCommands.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,33 @@
22

33
import com.r3944realms.dg_lab.websocket.message.data.type.PowerBoxDataType;
44

5+
/**
6+
* The type Power box commands.
7+
*/
58
public final class PowerBoxCommands {
9+
/**
10+
* The constant STRENGTH.
11+
*/
612
public static final String STRENGTH = "strength";
13+
/**
14+
* The constant PULSE.
15+
*/
716
public static final String PULSE = "pulse";
17+
/**
18+
* The constant CLEAR.
19+
*/
820
public static final String CLEAR = "clear";
21+
/**
22+
* The constant FEEDBACK.
23+
*/
924
public static final String FEEDBACK = "feedback";
25+
26+
/**
27+
* Gets command type.
28+
*
29+
* @param commandPrefix the command prefix
30+
* @return the command type
31+
*/
1032
static String getCommandType(PowerBoxDataType commandPrefix) {
1133
return switch (commandPrefix) {
1234
case STRENGTH -> STRENGTH;

0 commit comments

Comments
 (0)