From 69fadff47945701a295383f20a585012234d391e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 17 May 2023 05:02:10 +0000 Subject: [PATCH] Format code [skip actions] --- .../auth/DefaultAuthenticators.java | 24 +++++++-------- .../emu/grasscutter/game/world/Scene.java | 9 +++--- .../grasscutter/server/game/GameServer.java | 30 +++++++++---------- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/main/java/emu/grasscutter/auth/DefaultAuthenticators.java b/src/main/java/emu/grasscutter/auth/DefaultAuthenticators.java index 2c7a17ddc..1206eec5d 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.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.Language.translate; +import javax.crypto.Cipher; /** A class containing default authenticators. */ public final class DefaultAuthenticators { @@ -396,18 +395,17 @@ public final class DefaultAuthenticators { // Check to see if an IP authentication can be performed. if (Grasscutter.getRunMode() == ServerRunMode.HYBRID) { - var player = Grasscutter.getGameServer() - .getPlayerByIpAddress(ctx.ip()); + var player = Grasscutter.getGameServer().getPlayerByIpAddress(ctx.ip()); if (player != null) { // Get the player's session token. var sessionKey = player.getAccount().getSessionKey(); // Respond with the handbook auth page. - ctx.status(200).result( - this.authPage - .replace("{{VALUE}}", "true") - .replace("{{SESSION_TOKEN}}", sessionKey) - .replace("{{PLAYER_ID}}", String.valueOf(player.getUid())) - ); + ctx.status(200) + .result( + this.authPage + .replace("{{VALUE}}", "true") + .replace("{{SESSION_TOKEN}}", sessionKey) + .replace("{{PLAYER_ID}}", String.valueOf(player.getUid()))); return; } } diff --git a/src/main/java/emu/grasscutter/game/world/Scene.java b/src/main/java/emu/grasscutter/game/world/Scene.java index b9c5235eb..914a1250f 100644 --- a/src/main/java/emu/grasscutter/game/world/Scene.java +++ b/src/main/java/emu/grasscutter/game/world/Scene.java @@ -41,15 +41,14 @@ import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.KahnsSort; import emu.grasscutter.utils.Position; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import lombok.Getter; -import lombok.Setter; -import lombok.val; - -import javax.annotation.Nullable; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.stream.Collectors; +import javax.annotation.Nullable; +import lombok.Getter; +import lombok.Setter; +import lombok.val; public final class Scene { @Getter private final World world; diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index cf9e4457f..e4e897f57 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -1,5 +1,9 @@ package emu.grasscutter.server.game; +import static emu.grasscutter.config.Configuration.DISPATCH_INFO; +import static emu.grasscutter.config.Configuration.GAME_INFO; +import static emu.grasscutter.utils.Language.translate; + import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter.ServerRunMode; @@ -37,22 +41,17 @@ import emu.grasscutter.server.event.internal.ServerStopEvent; import emu.grasscutter.server.event.types.ServerEvent; import emu.grasscutter.server.scheduler.ServerTaskScheduler; import emu.grasscutter.task.TaskMap; -import kcp.highway.ChannelConfig; -import kcp.highway.KcpServer; -import lombok.Getter; -import lombok.Setter; -import lombok.SneakyThrows; - import java.net.InetSocketAddress; import java.net.URI; import java.time.Instant; import java.time.OffsetDateTime; import java.util.*; import java.util.concurrent.ConcurrentHashMap; - -import static emu.grasscutter.config.Configuration.DISPATCH_INFO; -import static emu.grasscutter.config.Configuration.GAME_INFO; -import static emu.grasscutter.utils.Language.translate; +import kcp.highway.ChannelConfig; +import kcp.highway.KcpServer; +import lombok.Getter; +import lombok.Setter; +import lombok.SneakyThrows; @Getter public final class GameServer extends KcpServer { @@ -255,11 +254,12 @@ public final class GameServer extends KcpServer { */ public Player getPlayerByIpAddress(String ipAddress) { return this.getPlayers().values().stream() - .map(Player::getSession) - .filter(session -> session != null && - session.getAddress().getHostString().equals(ipAddress)) - .map(GameSession::getPlayer) - .findFirst().orElse(null); + .map(Player::getSession) + .filter( + session -> session != null && session.getAddress().getHostString().equals(ipAddress)) + .map(GameSession::getPlayer) + .findFirst() + .orElse(null); } public SocialDetail.Builder getSocialDetailByUid(int id) {