From 45f4a9233d19d6e1e42d78b20bc6584c1b6d5c8f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 11 May 2023 23:46:37 +0000 Subject: [PATCH] Format code [skip actions] --- .../java/emu/grasscutter/Grasscutter.java | 19 +++++++------- .../emu/grasscutter/data/ResourceLoader.java | 19 +++++++------- .../grasscutter/game/entity/EntityRegion.java | 3 +-- .../scripts/SceneScriptManager.java | 25 +++++++++---------- .../grasscutter/scripts/data/SceneRegion.java | 3 +-- .../java/io/grasscutter/GrasscutterTest.java | 3 +-- 6 files changed, 33 insertions(+), 39 deletions(-) diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index 5b3ef28de..630761962 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; @@ -24,6 +27,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; @@ -35,16 +44,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/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index 660228796..de5d35ae5 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/game/entity/EntityRegion.java b/src/main/java/emu/grasscutter/game/entity/EntityRegion.java index f65a28fdc..6a52297b2 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityRegion.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityRegion.java @@ -6,10 +6,9 @@ import emu.grasscutter.net.proto.SceneEntityInfoOuterClass; import emu.grasscutter.scripts.data.SceneRegion; import emu.grasscutter.utils.Position; import it.unimi.dsi.fastutil.ints.Int2FloatMap; -import lombok.Getter; - import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import lombok.Getter; @Getter public class EntityRegion extends GameEntity { diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 9e9ac3fce..c82956004 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -1,5 +1,7 @@ package emu.grasscutter.scripts; +import static emu.grasscutter.scripts.constants.EventType.EVENT_TIMER_EVENT; + import com.github.davidmoten.rtreemulti.RTree; import com.github.davidmoten.rtreemulti.geometry.Geometry; import emu.grasscutter.Grasscutter; @@ -26,14 +28,6 @@ import emu.grasscutter.utils.Position; import io.netty.util.concurrent.FastThreadLocalThread; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import kotlin.Pair; -import lombok.val; -import org.luaj.vm2.LuaError; -import org.luaj.vm2.LuaValue; -import org.luaj.vm2.lib.jse.CoerceJavaToLua; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.FileWriter; import java.io.IOException; import java.nio.file.Files; @@ -41,8 +35,13 @@ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; - -import static emu.grasscutter.scripts.constants.EventType.EVENT_TIMER_EVENT; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import kotlin.Pair; +import lombok.val; +import org.luaj.vm2.LuaError; +import org.luaj.vm2.LuaValue; +import org.luaj.vm2.lib.jse.CoerceJavaToLua; public class SceneScriptManager { private final Scene scene; @@ -353,9 +352,9 @@ public class SceneScriptManager { public synchronized void deregisterRegion(SceneRegion region) { this.regions.values().stream() - .filter(r -> r.getMetaRegion().equals(region)) - .findFirst() - .ifPresent(entityRegion -> this.regions.remove(entityRegion.getId())); + .filter(r -> r.getMetaRegion().equals(region)) + .findFirst() + .ifPresent(entityRegion -> this.regions.remove(entityRegion.getId())); } public Map> getLoadedGroupSetPerBlock() { diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java b/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java index 1c02c25d3..076e33743 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java @@ -2,9 +2,8 @@ package emu.grasscutter.scripts.data; import emu.grasscutter.scripts.constants.ScriptRegionShape; import emu.grasscutter.utils.Position; -import lombok.Setter; - import java.util.List; +import lombok.Setter; @Setter public class SceneRegion { diff --git a/src/test/java/io/grasscutter/GrasscutterTest.java b/src/test/java/io/grasscutter/GrasscutterTest.java index 8c57bab16..7c2e7f7f9 100644 --- a/src/test/java/io/grasscutter/GrasscutterTest.java +++ b/src/test/java/io/grasscutter/GrasscutterTest.java @@ -3,6 +3,7 @@ package io.grasscutter; import com.mchange.util.AssertException; import emu.grasscutter.Grasscutter; import emu.grasscutter.config.Configuration; +import java.io.IOException; import lombok.Getter; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -11,8 +12,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import java.io.IOException; - /** Testing entrypoint for {@link Grasscutter}. */ public final class GrasscutterTest { @Getter private static final OkHttpClient httpClient = new OkHttpClient();