Format code [skip actions]

This commit is contained in:
github-actions 2023-05-11 23:46:37 +00:00
parent e514095e8a
commit 45f4a9233d
6 changed files with 33 additions and 39 deletions

View File

@ -1,5 +1,8 @@
package emu.grasscutter; 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.Level;
import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.Logger;
import emu.grasscutter.auth.AuthenticationSystem; 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.server.http.handlers.LogHandler;
import emu.grasscutter.tools.Tools; import emu.grasscutter.tools.Tools;
import emu.grasscutter.utils.*; 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.Getter;
import lombok.Setter; import lombok.Setter;
import org.jline.reader.EndOfFileException; import org.jline.reader.EndOfFileException;
@ -35,16 +44,6 @@ import org.jline.terminal.TerminalBuilder;
import org.reflections.Reflections; import org.reflections.Reflections;
import org.slf4j.LoggerFactory; 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 final class Grasscutter {
public static final File configFile = new File("./config.json"); public static final File configFile = new File("./config.json");
public static final Reflections reflector = new Reflections("emu.grasscutter"); public static final Reflections reflector = new Reflections("emu.grasscutter");

View File

@ -1,5 +1,9 @@
package emu.grasscutter.data; 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 com.google.gson.annotations.SerializedName;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.binout.*; 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.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntArraySet; 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.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.file.Files; import java.nio.file.Files;
@ -46,10 +44,11 @@ import java.util.concurrent.CopyOnWriteArraySet;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.script.Bindings;
import static emu.grasscutter.utils.FileUtils.getDataPath; import javax.script.CompiledScript;
import static emu.grasscutter.utils.FileUtils.getResourcePath; import lombok.SneakyThrows;
import static emu.grasscutter.utils.Language.translate; import lombok.val;
import org.reflections.Reflections;
public final class ResourceLoader { public final class ResourceLoader {

View File

@ -6,10 +6,9 @@ import emu.grasscutter.net.proto.SceneEntityInfoOuterClass;
import emu.grasscutter.scripts.data.SceneRegion; import emu.grasscutter.scripts.data.SceneRegion;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2FloatMap;
import lombok.Getter;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import lombok.Getter;
@Getter @Getter
public class EntityRegion extends GameEntity { public class EntityRegion extends GameEntity {

View File

@ -1,5 +1,7 @@
package emu.grasscutter.scripts; 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.RTree;
import com.github.davidmoten.rtreemulti.geometry.Geometry; import com.github.davidmoten.rtreemulti.geometry.Geometry;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
@ -26,14 +28,6 @@ import emu.grasscutter.utils.Position;
import io.netty.util.concurrent.FastThreadLocalThread; import io.netty.util.concurrent.FastThreadLocalThread;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; 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.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -41,8 +35,13 @@ import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import static emu.grasscutter.scripts.constants.EventType.EVENT_TIMER_EVENT; 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 { public class SceneScriptManager {
private final Scene scene; private final Scene scene;
@ -353,9 +352,9 @@ public class SceneScriptManager {
public synchronized void deregisterRegion(SceneRegion region) { public synchronized void deregisterRegion(SceneRegion region) {
this.regions.values().stream() this.regions.values().stream()
.filter(r -> r.getMetaRegion().equals(region)) .filter(r -> r.getMetaRegion().equals(region))
.findFirst() .findFirst()
.ifPresent(entityRegion -> this.regions.remove(entityRegion.getId())); .ifPresent(entityRegion -> this.regions.remove(entityRegion.getId()));
} }
public Map<Integer, Set<SceneGroup>> getLoadedGroupSetPerBlock() { public Map<Integer, Set<SceneGroup>> getLoadedGroupSetPerBlock() {

View File

@ -2,9 +2,8 @@ package emu.grasscutter.scripts.data;
import emu.grasscutter.scripts.constants.ScriptRegionShape; import emu.grasscutter.scripts.constants.ScriptRegionShape;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
import lombok.Setter;
import java.util.List; import java.util.List;
import lombok.Setter;
@Setter @Setter
public class SceneRegion { public class SceneRegion {

View File

@ -3,6 +3,7 @@ package io.grasscutter;
import com.mchange.util.AssertException; import com.mchange.util.AssertException;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.config.Configuration; import emu.grasscutter.config.Configuration;
import java.io.IOException;
import lombok.Getter; import lombok.Getter;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
@ -11,8 +12,6 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.IOException;
/** Testing entrypoint for {@link Grasscutter}. */ /** Testing entrypoint for {@link Grasscutter}. */
public final class GrasscutterTest { public final class GrasscutterTest {
@Getter private static final OkHttpClient httpClient = new OkHttpClient(); @Getter private static final OkHttpClient httpClient = new OkHttpClient();