From 57d98f1da7fabbd88e0b4bc2caf32d87462506f7 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 13 May 2023 21:13:46 +0000 Subject: [PATCH] Format code [skip actions] --- .../java/emu/grasscutter/Grasscutter.java | 19 +++++++++---------- .../emu/grasscutter/command/CommandMap.java | 7 +++---- .../emu/grasscutter/data/ResourceLoader.java | 19 +++++++++---------- .../data/excels/monster/MonsterData.java | 3 +-- .../grasscutter/database/DatabaseHelper.java | 5 ++--- .../emu/grasscutter/game/avatar/Avatar.java | 13 ++++++------- .../java/emu/grasscutter/plugin/Plugin.java | 5 ++--- .../server/http/handlers/GachaHandler.java | 18 +++++++++--------- 8 files changed, 41 insertions(+), 48 deletions(-) diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index de97bb11e..1ab52e101 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -1,5 +1,8 @@ package emu.grasscutter; +import static emu.grasscutter.config.Configuration.SERVER; +import static emu.grasscutter.utils.Language.translate; + import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import emu.grasscutter.auth.AuthenticationSystem; @@ -25,6 +28,12 @@ import emu.grasscutter.server.http.handlers.GenericHandler; import emu.grasscutter.server.http.handlers.LogHandler; import emu.grasscutter.tools.Tools; import emu.grasscutter.utils.*; +import java.io.File; +import java.io.FileWriter; +import java.io.IOError; +import java.io.IOException; +import java.util.Calendar; +import javax.annotation.Nullable; import lombok.Getter; import lombok.Setter; import org.jline.reader.EndOfFileException; @@ -36,16 +45,6 @@ import org.jline.terminal.TerminalBuilder; import org.reflections.Reflections; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import java.io.File; -import java.io.FileWriter; -import java.io.IOError; -import java.io.IOException; -import java.util.Calendar; - -import static emu.grasscutter.config.Configuration.SERVER; -import static emu.grasscutter.utils.Language.translate; - public final class Grasscutter { public static final File configFile = new File("./config.json"); public static final Reflections reflector = new Reflections("emu.grasscutter"); diff --git a/src/main/java/emu/grasscutter/command/CommandMap.java b/src/main/java/emu/grasscutter/command/CommandMap.java index 4bdb099eb..d8c70da06 100644 --- a/src/main/java/emu/grasscutter/command/CommandMap.java +++ b/src/main/java/emu/grasscutter/command/CommandMap.java @@ -1,15 +1,14 @@ package emu.grasscutter.command; +import static emu.grasscutter.config.Configuration.SERVER; + import emu.grasscutter.Grasscutter; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.player.Player; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import org.reflections.Reflections; - import java.util.*; - -import static emu.grasscutter.config.Configuration.SERVER; +import org.reflections.Reflections; @SuppressWarnings({"UnusedReturnValue", "unused"}) public final class CommandMap { diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index 196343ce5..cbbc1cc89 100644 --- a/src/main/java/emu/grasscutter/data/ResourceLoader.java +++ b/src/main/java/emu/grasscutter/data/ResourceLoader.java @@ -1,5 +1,9 @@ package emu.grasscutter.data; +import static emu.grasscutter.utils.FileUtils.getDataPath; +import static emu.grasscutter.utils.FileUtils.getResourcePath; +import static emu.grasscutter.utils.Language.translate; + import com.google.gson.annotations.SerializedName; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.binout.*; @@ -29,12 +33,6 @@ import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntArraySet; -import lombok.SneakyThrows; -import lombok.val; -import org.reflections.Reflections; - -import javax.script.Bindings; -import javax.script.CompiledScript; import java.io.IOException; import java.io.InputStreamReader; import java.nio.file.Files; @@ -46,10 +44,11 @@ import java.util.concurrent.CopyOnWriteArraySet; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static emu.grasscutter.utils.FileUtils.getDataPath; -import static emu.grasscutter.utils.FileUtils.getResourcePath; -import static emu.grasscutter.utils.Language.translate; +import javax.script.Bindings; +import javax.script.CompiledScript; +import lombok.SneakyThrows; +import lombok.val; +import org.reflections.Reflections; public final class ResourceLoader { diff --git a/src/main/java/emu/grasscutter/data/excels/monster/MonsterData.java b/src/main/java/emu/grasscutter/data/excels/monster/MonsterData.java index f85dbebcc..2a3b0f374 100644 --- a/src/main/java/emu/grasscutter/data/excels/monster/MonsterData.java +++ b/src/main/java/emu/grasscutter/data/excels/monster/MonsterData.java @@ -9,10 +9,9 @@ import emu.grasscutter.data.common.PropGrowCurve; import emu.grasscutter.data.excels.GadgetData; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.MonsterType; -import lombok.Getter; - import java.util.List; import java.util.Set; +import lombok.Getter; @ResourceType(name = "MonsterExcelConfigData.json", loadPriority = LoadPriority.LOW) @Getter diff --git a/src/main/java/emu/grasscutter/database/DatabaseHelper.java b/src/main/java/emu/grasscutter/database/DatabaseHelper.java index ca3d22644..94c391a9e 100644 --- a/src/main/java/emu/grasscutter/database/DatabaseHelper.java +++ b/src/main/java/emu/grasscutter/database/DatabaseHelper.java @@ -1,5 +1,7 @@ package emu.grasscutter.database; +import static com.mongodb.client.model.Filters.eq; + import com.mongodb.client.result.DeleteResult; import dev.morphia.query.FindOptions; import dev.morphia.query.Sort; @@ -20,12 +22,9 @@ import emu.grasscutter.game.mail.Mail; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.GameMainQuest; import emu.grasscutter.game.world.SceneGroupInstance; - import java.util.List; import java.util.stream.Stream; -import static com.mongodb.client.model.Filters.eq; - public final class DatabaseHelper { public static Account createAccount(String username) { return createAccountWithUid(username, 0); diff --git a/src/main/java/emu/grasscutter/game/avatar/Avatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java index 4b3b3b8b0..0b7292e16 100644 --- a/src/main/java/emu/grasscutter/game/avatar/Avatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -1,5 +1,7 @@ package emu.grasscutter.game.avatar; +import static emu.grasscutter.config.Configuration.GAME_OPTIONS; + import dev.morphia.annotations.*; import emu.grasscutter.GameConstants; import emu.grasscutter.data.GameData; @@ -40,19 +42,16 @@ import emu.grasscutter.net.proto.TrialAvatarInfoOuterClass.TrialAvatarInfo; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.ProtoHelper; import it.unimi.dsi.fastutil.ints.*; +import java.util.*; +import java.util.stream.Stream; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import lombok.val; import org.bson.types.ObjectId; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.*; -import java.util.stream.Stream; - -import static emu.grasscutter.config.Configuration.GAME_OPTIONS; - @Entity(value = "avatars", useDiscriminator = false) public class Avatar { @Transient @Getter private final Int2ObjectMap equips; diff --git a/src/main/java/emu/grasscutter/plugin/Plugin.java b/src/main/java/emu/grasscutter/plugin/Plugin.java index 41e6e05a7..7576f5d03 100644 --- a/src/main/java/emu/grasscutter/plugin/Plugin.java +++ b/src/main/java/emu/grasscutter/plugin/Plugin.java @@ -5,12 +5,11 @@ import emu.grasscutter.plugin.api.ServerHelper; import emu.grasscutter.plugin.api.ServerHook; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.utils.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.File; import java.io.InputStream; import java.net.URLClassLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** The base class for all plugins to extend. */ @SuppressWarnings("removal") diff --git a/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java b/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java index 765efc664..7ed622e8f 100644 --- a/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java +++ b/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java @@ -1,5 +1,7 @@ package emu.grasscutter.server.http.handlers; +import static emu.grasscutter.utils.Language.translate; + import emu.grasscutter.Grasscutter; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.Account; @@ -13,8 +15,6 @@ import io.javalin.Javalin; import io.javalin.http.ContentType; import io.javalin.http.Context; import io.javalin.http.staticfiles.Location; -import lombok.Getter; - import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -22,8 +22,7 @@ import java.nio.file.Path; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; - -import static emu.grasscutter.utils.Language.translate; +import lombok.Getter; /** Handles all gacha-related HTTP requests. */ public final class GachaHandler implements Router { @@ -145,10 +144,11 @@ public final class GachaHandler implements Router { javalin.get("/gacha", GachaHandler::gachaRecords); javalin.get("/gacha/details", GachaHandler::gachaDetails); - javalin.cfg.staticFiles.add(cfg -> { - cfg.hostedPath = "/gacha/mappings"; - cfg.directory = gachaMappingsPath.toString(); - cfg.location = Location.EXTERNAL; - }); + javalin.cfg.staticFiles.add( + cfg -> { + cfg.hostedPath = "/gacha/mappings"; + cfg.directory = gachaMappingsPath.toString(); + cfg.location = Location.EXTERNAL; + }); } }