From 07205d9a3aa4ddeace15dcd0137932621849e03c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 31 May 2023 06:12:06 +0000 Subject: [PATCH] Format code [skip actions] --- .../emu/grasscutter/auth/DefaultAuthenticators.java | 9 ++++----- .../server/http/dispatch/AuthenticationHandler.java | 13 ++++++++----- .../server/http/dispatch/RegionHandler.java | 11 ++++++----- .../server/http/objects/HttpJsonResponse.java | 9 ++++----- src/main/java/emu/grasscutter/utils/Utils.java | 11 +++++------ 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/main/java/emu/grasscutter/auth/DefaultAuthenticators.java b/src/main/java/emu/grasscutter/auth/DefaultAuthenticators.java index c53854471..1df155f4b 100644 --- a/src/main/java/emu/grasscutter/auth/DefaultAuthenticators.java +++ b/src/main/java/emu/grasscutter/auth/DefaultAuthenticators.java @@ -1,5 +1,8 @@ package emu.grasscutter.auth; +import static emu.grasscutter.config.Configuration.ACCOUNT; +import static emu.grasscutter.utils.lang.Language.translate; + import at.favre.lib.crypto.bcrypt.BCrypt; import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter.ServerRunMode; @@ -14,17 +17,13 @@ import emu.grasscutter.utils.DispatchUtils; import emu.grasscutter.utils.FileUtils; import emu.grasscutter.utils.Utils; import io.javalin.http.ContentType; - -import javax.crypto.Cipher; import java.nio.charset.StandardCharsets; import java.security.KeyFactory; import java.security.interfaces.RSAPrivateKey; import java.security.spec.PKCS8EncodedKeySpec; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; - -import static emu.grasscutter.config.Configuration.ACCOUNT; -import static emu.grasscutter.utils.lang.Language.translate; +import javax.crypto.Cipher; /** A class containing default authenticators. */ public final class DefaultAuthenticators { diff --git a/src/main/java/emu/grasscutter/server/http/dispatch/AuthenticationHandler.java b/src/main/java/emu/grasscutter/server/http/dispatch/AuthenticationHandler.java index 92fe29d30..6959b6c74 100644 --- a/src/main/java/emu/grasscutter/server/http/dispatch/AuthenticationHandler.java +++ b/src/main/java/emu/grasscutter/server/http/dispatch/AuthenticationHandler.java @@ -1,5 +1,7 @@ package emu.grasscutter.server.http.dispatch; +import static emu.grasscutter.utils.lang.Language.translate; + import emu.grasscutter.Grasscutter; import emu.grasscutter.auth.AuthenticationSystem; import emu.grasscutter.auth.OAuthAuthenticator.ClientType; @@ -13,8 +15,6 @@ import emu.grasscutter.utils.Utils; import io.javalin.Javalin; import io.javalin.http.Context; -import static emu.grasscutter.utils.lang.Language.translate; - /** Handles requests related to authentication. */ public final class AuthenticationHandler implements Router { /** @@ -37,7 +37,8 @@ public final class AuthenticationHandler implements Router { ctx.json(responseData); // Log to console. - Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx))); + Grasscutter.getLogger() + .info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx))); } /** @@ -60,7 +61,8 @@ public final class AuthenticationHandler implements Router { ctx.json(responseData); // Log to console. - Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx))); + Grasscutter.getLogger() + .info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx))); } /** @@ -86,7 +88,8 @@ public final class AuthenticationHandler implements Router { ctx.json(responseData); // Log to console. - Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx))); + Grasscutter.getLogger() + .info(translate("messages.dispatch.account.login_attempt", Utils.address(ctx))); } @Override diff --git a/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java b/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java index 76a923c81..0993d8da5 100644 --- a/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java +++ b/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java @@ -1,5 +1,7 @@ package emu.grasscutter.server.http.dispatch; +import static emu.grasscutter.config.Configuration.*; + import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.protobuf.ByteString; @@ -21,15 +23,12 @@ import emu.grasscutter.utils.JsonUtils; import emu.grasscutter.utils.Utils; import io.javalin.Javalin; import io.javalin.http.Context; -import org.slf4j.Logger; - import java.time.Instant; import java.util.ArrayList; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Pattern; - -import static emu.grasscutter.config.Configuration.*; +import org.slf4j.Logger; /** Handles requests related to region queries. */ public final class RegionHandler implements Router { @@ -314,7 +313,9 @@ public final class RegionHandler implements Router { } // Log to console. Grasscutter.getLogger() - .info(String.format("Client %s request: query_cur_region/%s", Utils.address(ctx), regionName)); + .info( + String.format( + "Client %s request: query_cur_region/%s", Utils.address(ctx), regionName)); } /** Region data container. */ diff --git a/src/main/java/emu/grasscutter/server/http/objects/HttpJsonResponse.java b/src/main/java/emu/grasscutter/server/http/objects/HttpJsonResponse.java index 8d579779b..aade47d68 100644 --- a/src/main/java/emu/grasscutter/server/http/objects/HttpJsonResponse.java +++ b/src/main/java/emu/grasscutter/server/http/objects/HttpJsonResponse.java @@ -1,17 +1,16 @@ package emu.grasscutter.server.http.objects; +import static emu.grasscutter.config.Configuration.DISPATCH_INFO; +import static emu.grasscutter.utils.lang.Language.translate; + import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter.ServerDebugMode; import emu.grasscutter.utils.Utils; import io.javalin.http.Context; import io.javalin.http.Handler; -import org.jetbrains.annotations.NotNull; - import java.util.Arrays; import java.util.Objects; - -import static emu.grasscutter.config.Configuration.DISPATCH_INFO; -import static emu.grasscutter.utils.lang.Language.translate; +import org.jetbrains.annotations.NotNull; public final class HttpJsonResponse implements Handler { private final String response; diff --git a/src/main/java/emu/grasscutter/utils/Utils.java b/src/main/java/emu/grasscutter/utils/Utils.java index b895642a8..3042555ca 100644 --- a/src/main/java/emu/grasscutter/utils/Utils.java +++ b/src/main/java/emu/grasscutter/utils/Utils.java @@ -1,5 +1,8 @@ package emu.grasscutter.utils; +import static emu.grasscutter.utils.FileUtils.getResourcePath; +import static emu.grasscutter.utils.lang.Language.translate; + import emu.grasscutter.Grasscutter; import emu.grasscutter.config.ConfigContainer; import emu.grasscutter.data.DataLoader; @@ -10,9 +13,6 @@ import io.netty.buffer.ByteBufUtil; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; -import org.slf4j.Logger; - -import javax.annotation.Nullable; import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -24,9 +24,8 @@ import java.time.ZonedDateTime; import java.time.temporal.TemporalAdjusters; import java.util.*; import java.util.concurrent.ThreadLocalRandom; - -import static emu.grasscutter.utils.FileUtils.getResourcePath; -import static emu.grasscutter.utils.lang.Language.translate; +import javax.annotation.Nullable; +import org.slf4j.Logger; @SuppressWarnings({"UnusedReturnValue", "BooleanMethodIsAlwaysInverted"}) public final class Utils {