update blank question rule

version 1.0.2
This commit is contained in:
LostInLinearPast 2025-10-31 22:57:38 +08:00
parent a64da463ff
commit 117f7d222c
4 changed files with 10 additions and 91 deletions

View File

@ -8,6 +8,7 @@ import org.springframework.core.env.PropertySource;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class ConfigLoader implements EnvironmentPostProcessor {
public static final Map<String, String> config = new HashMap<>();
@ -20,7 +21,7 @@ public class ConfigLoader implements EnvironmentPostProcessor {
).findFirst().orElseThrow();
if(source instanceof MapPropertySource mapPropertySource) {
for (String key : mapPropertySource.getPropertyNames()) {
config.put(key, mapPropertySource.getProperty(key).toString());
config.put(key, Objects.requireNonNull(mapPropertySource.getProperty(key)).toString());
System.out.println(key + "=" + mapPropertySource.getProperty(key));
}
}

View File

@ -33,17 +33,6 @@ import java.util.Map;
public class HttpUtils {
/**
* get
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doGet(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
@ -58,18 +47,6 @@ public class HttpUtils {
return httpClient.execute(request);
}
/**
* post form
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param bodys
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
@ -96,18 +73,6 @@ public class HttpUtils {
return httpClient.execute(request);
}
/**
* Post String
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
@ -127,18 +92,6 @@ public class HttpUtils {
return httpClient.execute(request);
}
/**
* Post stream
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
@ -158,17 +111,6 @@ public class HttpUtils {
return httpClient.execute(request);
}
/**
* Put String
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
@ -188,17 +130,6 @@ public class HttpUtils {
return httpClient.execute(request);
}
/**
* Put stream
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
@ -218,17 +149,6 @@ public class HttpUtils {
return httpClient.execute(request);
}
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
@ -252,7 +172,7 @@ public class HttpUtils {
if (null != querys) {
StringBuilder sbQuery = new StringBuilder();
for (Map.Entry<String, String> query : querys.entrySet()) {
if (0 < sbQuery.length()) {
if (!sbQuery.isEmpty()) {
sbQuery.append("&");
}
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
@ -266,7 +186,7 @@ public class HttpUtils {
}
}
}
if (0 < sbQuery.length()) {
if (!sbQuery.isEmpty()) {
sbUrl.append("?").append(sbQuery);
}
}

View File

@ -55,9 +55,8 @@ public class ConnectTask implements Callable<MinecraftClient> {
try {
log.debug("Pausing for {} ms", this.connectOptions.getTimeBetweenRetries().toMillis());
Thread.sleep(this.connectOptions.getTimeBetweenRetries().toMillis());
} catch (InterruptedException var2) {
InterruptedException e = var2;
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}

View File

@ -12,6 +12,7 @@ import java.util.concurrent.*;
import io.graversen.minecraft.rcon.service.ConnectOptions;
import io.graversen.minecraft.rcon.service.*;
import lombok.Setter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,7 +23,8 @@ public class MinecraftRconUtils {
private final ScheduledExecutorService executorService;
private volatile IMinecraftClient minecraftClient;
private volatile MinecraftRcon minecraftRcon;
private volatile boolean isConnected;
@Setter
private volatile boolean isConnected;
private volatile CountDownLatch connectionLatch;
public MinecraftRconUtils(RconDetails rconDetails, ConnectOptions connectOptions) {
@ -108,11 +110,8 @@ public class MinecraftRconUtils {
if(this.minecraftClient != null) this.minecraftRcon = new MinecraftRcon(this.minecraftClient);
else this.minecraftRcon = null;
}
public void setConnected(boolean connected) {
this.isConnected = connected;
}
private class TestConnect implements Runnable {
private class TestConnect implements Runnable {
private final RconDetails rconDetails;
TestConnect(RconDetails rconDetails) {
this.rconDetails = rconDetails;