generated from mingliqiye/lib-tem
no message
This commit is contained in:
parent
9796338c72
commit
34006c08b6
@ -38,7 +38,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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
GROUPSID=com.mingliqiye
|
GROUPSID=com.mingliqiye
|
||||||
ARTIFACTID=minecraft-SLP
|
ARTIFACTID=minecraft-SLP
|
||||||
VERSIONS=1.0.1
|
VERSIONS=1.0.2
|
||||||
MAINCLASS=com.mingliqiye.minecraftSLP.Main
|
MAINCLASS=com.mingliqiye.minecraftSLP.Main
|
||||||
JDKVERSIONS=1.8
|
JDKVERSIONS=1.8
|
||||||
|
@ -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": "",
|
||||||
|
@ -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("请使用 {地址}:{端口号}");
|
||||||
|
@ -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
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user