9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-04 15:41:38 +00:00

加点检测

This commit is contained in:
XiaoMoMi
2025-05-23 21:33:39 +08:00
parent c34ec30212
commit d0e2429008
5 changed files with 63 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ public class SelfHostHttpServer {
private boolean denyNonMinecraft = true;
private boolean useToken;
private volatile byte[] resourcePackBytes;
private byte[] resourcePackBytes;
private String packHash;
private UUID packUUID;
@@ -93,6 +93,14 @@ public class SelfHostHttpServer {
}
}
public boolean isAlive() {
return this.server != null;
}
public byte[] resourcePackBytes() {
return resourcePackBytes;
}
public static SelfHostHttpServer instance() {
if (instance == null) {
instance = new SelfHostHttpServer();
@@ -173,6 +181,7 @@ public class SelfHostHttpServer {
this.server = null;
if (this.threadPool != null) {
this.threadPool.shutdownNow();
this.threadPool = null;
}
}
}
@@ -262,8 +271,11 @@ public class SelfHostHttpServer {
try (OutputStream os = exchange.getResponseBody()) {
os.write(resourcePackBytes);
} catch (IOException e) {
CraftEngine.instance().logger().warn("Failed to send resource pack", e);
throw e;
if (!e.getMessage().contains("abort") && !e.getMessage().contains("reset")) {
CraftEngine.instance().logger().warn("Failed to send resource pack", e);
throw e;
}
CraftEngine.instance().debug(() -> "Client aborted resource pack download: " + e.getMessage());
}
}