Compare commits

...

3 Commits

Author SHA1 Message Date
2fef29c1c2
no message
All checks were successful
Gitea Actions Build / Build (push) Successful in 50s
2025-07-10 16:05:18 +08:00
2a27d11273
no message
All checks were successful
Gitea Actions Build / Build (push) Successful in 50s
2025-07-10 15:21:58 +08:00
34006c08b6
no message 2025-07-10 15:21:38 +08:00
12 changed files with 171 additions and 37 deletions

View File

@ -1,4 +1,3 @@
import java.security.MessageDigest import java.security.MessageDigest
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
@ -38,7 +37,7 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation("org.jetbrains:annotations:24.0.0") implementation("org.jetbrains:annotations:24.0.0")
annotationProcessor("org.jetbrains:annotations:24.0.0") annotationProcessor("org.jetbrains:annotations:24.0.0")
implementation("com.alibaba.fastjson2:fastjson2:2.0.57") implementation("com.fasterxml.jackson.core:jackson-databind:2.19.1")
implementation("com.mingliqiye:network-endpoint:1.0.3") implementation("com.mingliqiye:network-endpoint:1.0.3")
} }
@ -136,8 +135,14 @@ tasks.register("build-jar") {
getHash(libDir.toString(), File(libDir, jarName)) getHash(libDir.toString(), File(libDir, jarName))
getHash(libDir.toString(), File(libDir, fatJarName)) getHash(libDir.toString(), File(libDir, fatJarName))
getHash(libDir.toString(), File(libDir, srcJarName)) getHash(libDir.toString(), File(libDir, srcJarName))
getHash(publicationsDir.toString(),File(publicationsDir, "module.json")) getHash(
getHash(publicationsDir.toString(),File(publicationsDir, "pom-default.xml")) publicationsDir.toString(),
File(publicationsDir, "module.json")
)
getHash(
publicationsDir.toString(),
File(publicationsDir, "pom-default.xml")
)
} }
} }
components { components {

View File

@ -1,5 +1,5 @@
GROUPSID=com.mingliqiye GROUPSID=com.mingliqiye
ARTIFACTID=minecraft-SLP ARTIFACTID=minecraft-SLP
VERSIONS=1.0.1 VERSIONS=1.0.3
MAINCLASS=com.mingliqiye.minecraftSLP.Main MAINCLASS=com.mingliqiye.minecraftSLP.Main
JDKVERSIONS=1.8 JDKVERSIONS=1.8

View File

@ -5,7 +5,7 @@
"scripts": { "scripts": {
"build": "gradle build-jar", "build": "gradle build-jar",
"buildw": "gradlew build-jar", "buildw": "gradlew build-jar",
"format": "prettier --write \"**/*.java\"" "format": "prettier --write \"**/*.{java,json}\""
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View File

@ -6,6 +6,10 @@ import java.io.IOException;
public class Main { public class Main {
static {
System.setProperty("fastjson2.parser.safeMode", "true");
}
public static void main(String[] args) { public static void main(String[] args) {
if (args.length != 1) { if (args.length != 1) {
System.err.println("请使用 {地址}:{端口号}"); System.err.println("请使用 {地址}:{端口号}");

View File

@ -1,6 +1,5 @@
package com.mingliqiye.minecraftSLP; package com.mingliqiye.minecraftSLP;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -14,7 +13,8 @@ public class MinecraftServerStatus {
private boolean previewsChat; private boolean previewsChat;
private String jsonData; private String jsonData;
// Getters and Setters public MinecraftServerStatus() {}
public Description getDescription() { public Description getDescription() {
return description; return description;
} }
@ -71,12 +71,13 @@ public class MinecraftServerStatus {
this.jsonData = jsonData; this.jsonData = jsonData;
} }
// Nested Classes
public static class Description { public static class Description {
private String text; private String text;
private Extra[] extra; private Extra[] extra;
public Description() {}
public String getText() { public String getText() {
return text; return text;
} }
@ -142,6 +143,8 @@ public class MinecraftServerStatus {
private int online; private int online;
private PlayerSample[] sample; private PlayerSample[] sample;
public Players() {}
public int getMax() { public int getMax() {
return max; return max;
} }
@ -202,6 +205,8 @@ public class MinecraftServerStatus {
private String name; private String name;
private int protocol; private int protocol;
public Version() {}
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -1,6 +1,6 @@
package com.mingliqiye.minecraftSLP; package com.mingliqiye.minecraftSLP;
import com.alibaba.fastjson2.JSON; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mingliqiye.network.endpoint.NetworkEndpoint; import com.mingliqiye.network.endpoint.NetworkEndpoint;
import java.io.*; import java.io.*;
import java.net.Socket; import java.net.Socket;
@ -9,6 +9,8 @@ import java.nio.ByteOrder;
public class SLP { public class SLP {
private static final ObjectMapper objectMapper = new ObjectMapper();
/** /**
* int32 4个字节 转换为 short 2 个字节 * int32 4个字节 转换为 short 2 个字节
* @param value int32 * @param value int32
@ -72,7 +74,7 @@ public class SLP {
int lengthjson = readVarInt(inputStream); int lengthjson = readVarInt(inputStream);
byte[] data = new byte[lengthjson]; byte[] data = new byte[lengthjson];
inputStream.readFully(data); inputStream.readFully(data);
MinecraftServerStatus serverStatus = JSON.parseObject( MinecraftServerStatus serverStatus = objectMapper.readValue(
data, data,
MinecraftServerStatus.class MinecraftServerStatus.class
); );

View File

@ -0,0 +1,8 @@
[
{
"name": "java.lang.Boolean",
"methods": [
{ "name": "getBoolean", "parameterTypes": ["java.lang.String"] }
]
}
]

View File

@ -0,0 +1,6 @@
[
{
"type": "agent-extracted",
"classes": []
}
]

View File

@ -0,0 +1 @@
[]

View File

@ -0,0 +1,88 @@
[
{
"name": "[Lcom.mingliqiye.minecraftSLP.MinecraftServerStatus$Description$Extra;"
},
{
"name": "[Lcom.mingliqiye.minecraftSLP.MinecraftServerStatus$Players$PlayerSample;"
},
{
"name": "com.fasterxml.jackson.databind.ext.Java7SupportImpl",
"methods": [{ "name": "<init>", "parameterTypes": [] }]
},
{
"name": "com.mingliqiye.minecraftSLP.MinecraftServerStatus",
"allDeclaredFields": true,
"queryAllDeclaredMethods": true,
"queryAllDeclaredConstructors": true,
"methods": [
{ "name": "<init>", "parameterTypes": [] },
{
"name": "setDescription",
"parameterTypes": [
"com.mingliqiye.minecraftSLP.MinecraftServerStatus$Description"
]
},
{ "name": "setEnforcesSecureChat", "parameterTypes": ["boolean"] },
{
"name": "setPlayers",
"parameterTypes": [
"com.mingliqiye.minecraftSLP.MinecraftServerStatus$Players"
]
},
{
"name": "setVersion",
"parameterTypes": [
"com.mingliqiye.minecraftSLP.MinecraftServerStatus$Version"
]
}
]
},
{
"name": "com.mingliqiye.minecraftSLP.MinecraftServerStatus$Description",
"allDeclaredFields": true,
"queryAllDeclaredMethods": true,
"queryAllDeclaredConstructors": true,
"methods": [
{ "name": "<init>", "parameterTypes": [] },
{ "name": "setText", "parameterTypes": ["java.lang.String"] }
]
},
{
"name": "com.mingliqiye.minecraftSLP.MinecraftServerStatus$Description$Extra",
"allDeclaredFields": true,
"queryAllDeclaredMethods": true,
"queryAllDeclaredConstructors": true
},
{
"name": "com.mingliqiye.minecraftSLP.MinecraftServerStatus$Players",
"allDeclaredFields": true,
"queryAllDeclaredMethods": true,
"queryAllDeclaredConstructors": true,
"methods": [
{ "name": "<init>", "parameterTypes": [] },
{ "name": "setMax", "parameterTypes": ["int"] },
{ "name": "setOnline", "parameterTypes": ["int"] }
]
},
{
"name": "com.mingliqiye.minecraftSLP.MinecraftServerStatus$Players$PlayerSample",
"allDeclaredFields": true,
"queryAllDeclaredMethods": true,
"queryAllDeclaredConstructors": true
},
{
"name": "com.mingliqiye.minecraftSLP.MinecraftServerStatus$Version",
"allDeclaredFields": true,
"queryAllDeclaredMethods": true,
"queryAllDeclaredConstructors": true,
"methods": [
{ "name": "<init>", "parameterTypes": [] },
{ "name": "setName", "parameterTypes": ["java.lang.String"] },
{ "name": "setProtocol", "parameterTypes": ["int"] }
]
},
{
"name": "java.util.concurrent.atomic.AtomicReference",
"fields": [{ "name": "value" }]
}
]

View File

@ -0,0 +1,10 @@
{
"resources": {
"includes": [
{
"pattern": "\\QMETA-INF/services/java.time.zone.ZoneRulesProvider\\E"
}
]
},
"bundles": []
}

View File

@ -0,0 +1,5 @@
{
"types": [],
"lambdaCapturingTypes": [],
"proxies": []
}