diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index 8fe76a612..47be2d310 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.lang.Language.translate; + import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import emu.grasscutter.auth.AuthenticationSystem; @@ -30,6 +33,12 @@ import emu.grasscutter.utils.JsonUtils; import emu.grasscutter.utils.StartupArguments; import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.lang.Language; +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; @@ -41,16 +50,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.lang.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/commands/KillAllCommand.java b/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java index f2277574a..7472bcada 100644 --- a/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java @@ -1,16 +1,15 @@ package emu.grasscutter.command.commands; +import static emu.grasscutter.utils.lang.Language.translate; + import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.entity.EntityMonster; import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.world.Scene; - import java.util.List; -import static emu.grasscutter.utils.lang.Language.translate; - @Command( label = "killall", usage = {"[]"}, diff --git a/src/main/java/emu/grasscutter/command/commands/SetConstCommand.java b/src/main/java/emu/grasscutter/command/commands/SetConstCommand.java index 9833f367c..6eaee6fd8 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetConstCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetConstCommand.java @@ -5,10 +5,10 @@ import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.World; import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify; -import emu.grasscutter.game.world.Position; import java.util.List; @Command( diff --git a/src/main/java/emu/grasscutter/command/commands/SoundCommand.java b/src/main/java/emu/grasscutter/command/commands/SoundCommand.java index 17555ad85..9c673a5df 100644 --- a/src/main/java/emu/grasscutter/command/commands/SoundCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SoundCommand.java @@ -5,8 +5,8 @@ import static emu.grasscutter.utils.lang.Language.translate; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; -import emu.grasscutter.server.packet.send.PacketScenePlayerSoundNotify; import emu.grasscutter.game.world.Position; +import emu.grasscutter.server.packet.send.PacketScenePlayerSoundNotify; import java.util.List; import lombok.val; diff --git a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java index cdc735c38..f555cf308 100644 --- a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java @@ -14,8 +14,8 @@ import emu.grasscutter.game.entity.*; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.EntityType; import emu.grasscutter.game.props.FightProperty; -import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.Position; +import emu.grasscutter.game.world.Scene; import java.util.List; import java.util.Map; import java.util.function.BiConsumer; diff --git a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java index 06812c690..9e72f8f71 100644 --- a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java @@ -5,8 +5,8 @@ import static emu.grasscutter.utils.lang.Language.translate; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; -import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType; import emu.grasscutter.game.world.Position; +import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType; import java.util.List; @Command( diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index abe4630d5..42b1f82ca 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.lang.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.lang.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/binout/routes/RoutePoint.java b/src/main/java/emu/grasscutter/data/binout/routes/RoutePoint.java index e7ca9fbb2..c8bd79e6c 100644 --- a/src/main/java/emu/grasscutter/data/binout/routes/RoutePoint.java +++ b/src/main/java/emu/grasscutter/data/binout/routes/RoutePoint.java @@ -1,7 +1,7 @@ package emu.grasscutter.data.binout.routes; -import emu.grasscutter.net.proto.RoutePointOuterClass; import emu.grasscutter.game.world.Position; +import emu.grasscutter.net.proto.RoutePointOuterClass; import lombok.AccessLevel; import lombok.Data; import lombok.experimental.FieldDefaults; diff --git a/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java b/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java index 013c9574f..995c49700 100644 --- a/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java +++ b/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java @@ -5,8 +5,8 @@ import emu.grasscutter.data.GameResource; import emu.grasscutter.data.ResourceType; import emu.grasscutter.data.excels.RewardPreviewData; import emu.grasscutter.game.dungeons.enums.*; -import emu.grasscutter.scripts.data.SceneMeta; import emu.grasscutter.game.world.Position; +import emu.grasscutter.scripts.data.SceneMeta; import java.util.List; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/data/server/Grid.java b/src/main/java/emu/grasscutter/data/server/Grid.java index d0c333324..537376ce6 100644 --- a/src/main/java/emu/grasscutter/data/server/Grid.java +++ b/src/main/java/emu/grasscutter/data/server/Grid.java @@ -3,9 +3,9 @@ package emu.grasscutter.data.server; import com.github.davidmoten.rtreemulti.RTree; import com.github.davidmoten.rtreemulti.geometry.Geometry; import emu.grasscutter.Grasscutter; -import emu.grasscutter.scripts.SceneIndexManager; import emu.grasscutter.game.world.GridPosition; import emu.grasscutter.game.world.Position; +import emu.grasscutter.scripts.SceneIndexManager; import java.util.*; public class Grid { diff --git a/src/main/java/emu/grasscutter/game/chat/ChatSystem.java b/src/main/java/emu/grasscutter/game/chat/ChatSystem.java index fc80b5d05..07cdbe963 100644 --- a/src/main/java/emu/grasscutter/game/chat/ChatSystem.java +++ b/src/main/java/emu/grasscutter/game/chat/ChatSystem.java @@ -1,5 +1,7 @@ package emu.grasscutter.game.chat; +import static emu.grasscutter.config.Configuration.GAME_INFO; + import emu.grasscutter.GameConstants; import emu.grasscutter.command.CommandMap; import emu.grasscutter.game.player.Player; @@ -11,15 +13,12 @@ import emu.grasscutter.server.packet.send.PacketPrivateChatNotify; import emu.grasscutter.server.packet.send.PacketPullPrivateChatRsp; import emu.grasscutter.server.packet.send.PacketPullRecentChatRsp; import emu.grasscutter.utils.Utils; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Pattern; -import static emu.grasscutter.config.Configuration.GAME_INFO; - public class ChatSystem implements ChatSystemHandler { static final String PREFIXES = "[/!]"; static final Pattern RE_PREFIXES = Pattern.compile(PREFIXES); @@ -142,7 +141,8 @@ public class ChatSystem implements ChatSystemHandler { // Invoke the chat event. var event = new PlayerChatEvent(player, message, target); - event.call(); if (event.isCanceled()) return; + event.call(); + if (event.isCanceled()) return; // Fetch the new target. if (targetUid != GameConstants.SERVER_CONSOLE_UID) { @@ -179,7 +179,8 @@ public class ChatSystem implements ChatSystemHandler { // Invoke the chat event. var event = new PlayerChatEvent(player, emote, target); - event.call(); if (event.isCanceled()) return; + event.call(); + if (event.isCanceled()) return; // Fetch the new target. if (targetUid != GameConstants.SERVER_CONSOLE_UID) { @@ -216,7 +217,8 @@ public class ChatSystem implements ChatSystemHandler { // Invoke the chat event. var event = new PlayerChatEvent(player, message, channel); - event.call(); if (event.isCanceled()) return; + event.call(); + if (event.isCanceled()) return; // Fetch the new message. message = event.getMessage(); @@ -232,7 +234,8 @@ public class ChatSystem implements ChatSystemHandler { public void sendTeamMessage(Player player, int channel, int icon) { // Invoke the chat event. var event = new PlayerChatEvent(player, icon, channel); - event.call(); if (event.isCanceled()) return; + event.call(); + if (event.isCanceled()) return; // Fetch the new icon. icon = event.getMessageAsInt(); diff --git a/src/main/java/emu/grasscutter/game/drop/DropSystemLegacy.java b/src/main/java/emu/grasscutter/game/drop/DropSystemLegacy.java index afd890aa1..af0e6a193 100644 --- a/src/main/java/emu/grasscutter/game/drop/DropSystemLegacy.java +++ b/src/main/java/emu/grasscutter/game/drop/DropSystemLegacy.java @@ -10,10 +10,10 @@ import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ActionReason; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java index ead09dbaf..104d2f9c5 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java @@ -15,12 +15,12 @@ import emu.grasscutter.game.props.ActivityType; import emu.grasscutter.game.props.WatcherTriggerType; import emu.grasscutter.game.quest.enums.LogicType; import emu.grasscutter.game.quest.enums.QuestContent; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.scripts.constants.EventType; import emu.grasscutter.scripts.data.ScriptArgs; import emu.grasscutter.server.packet.send.PacketDungeonWayPointNotify; import emu.grasscutter.server.packet.send.PacketGadgetAutoPickDropInfoNotify; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java index 9c4334ac9..b161eee48 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java @@ -9,20 +9,19 @@ import emu.grasscutter.data.excels.dungeon.DungeonPassConfigData; import emu.grasscutter.game.dungeons.handlers.DungeonBaseHandler; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.SceneType; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketDungeonEntryInfoRsp; -import emu.grasscutter.game.world.Position; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import java.util.List; import lombok.val; import org.reflections.Reflections; -import java.util.List; - public class DungeonSystem extends BaseGameSystem { private static final BasicDungeonSettleListener basicDungeonSettleObserver = new BasicDungeonSettleListener(); diff --git a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java index c2fce31c9..869c8dd46 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java @@ -12,6 +12,7 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.AbilityControlBlockOuterClass.AbilityControlBlock; import emu.grasscutter.net.proto.AbilityEmbryoOuterClass.AbilityEmbryo; @@ -34,9 +35,8 @@ import emu.grasscutter.server.event.player.PlayerMoveEvent; import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; import emu.grasscutter.server.packet.send.PacketEntityFightPropChangeReasonNotify; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; -import emu.grasscutter.game.world.Position; -import emu.grasscutter.utils.helpers.ProtoHelper; import emu.grasscutter.utils.Utils; +import emu.grasscutter.utils.helpers.ProtoHelper; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import lombok.Getter; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java b/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java index 3f2d1325a..bd17acca6 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java @@ -5,10 +5,10 @@ import static emu.grasscutter.scripts.constants.EventType.EVENT_SPECIFIC_GADGET_ import emu.grasscutter.data.binout.config.ConfigEntityGadget; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.quest.enums.QuestContent; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.scripts.data.ScriptArgs; import emu.grasscutter.server.event.entity.EntityDamageEvent; -import emu.grasscutter.game.world.Position; import lombok.Getter; public abstract class EntityBaseGadget extends GameEntity { diff --git a/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java b/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java index 6fb185555..c25528a4b 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityClientGadget.java @@ -2,6 +2,7 @@ package emu.grasscutter.game.entity; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; @@ -17,7 +18,6 @@ import emu.grasscutter.net.proto.SceneEntityAiInfoOuterClass.SceneEntityAiInfo; import emu.grasscutter.net.proto.SceneEntityInfoOuterClass.SceneEntityInfo; import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo; import emu.grasscutter.net.proto.VectorOuterClass.Vector; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.helpers.ProtoHelper; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityGadget.java b/src/main/java/emu/grasscutter/game/entity/EntityGadget.java index 2608677f6..b85dae75d 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityGadget.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityGadget.java @@ -9,6 +9,7 @@ import emu.grasscutter.game.entity.gadget.platform.BaseRoute; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.SceneGroupInstance; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; @@ -34,7 +35,6 @@ import emu.grasscutter.server.packet.send.PacketGadgetStateNotify; import emu.grasscutter.server.packet.send.PacketPlatformStartRouteNotify; import emu.grasscutter.server.packet.send.PacketPlatformStopRouteNotify; import emu.grasscutter.server.packet.send.PacketSceneTimeNotify; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.helpers.ProtoHelper; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityItem.java b/src/main/java/emu/grasscutter/game/entity/EntityItem.java index d985dba6e..a8b9253cb 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityItem.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityItem.java @@ -6,6 +6,7 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; @@ -23,7 +24,6 @@ import emu.grasscutter.net.proto.SceneEntityInfoOuterClass.SceneEntityInfo; import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo; import emu.grasscutter.net.proto.VectorOuterClass.Vector; import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.helpers.ProtoHelper; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityNPC.java b/src/main/java/emu/grasscutter/game/entity/EntityNPC.java index 896416ff9..d0fcfdb3c 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityNPC.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityNPC.java @@ -1,10 +1,10 @@ package emu.grasscutter.game.entity; import emu.grasscutter.game.props.EntityIdType; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.*; import emu.grasscutter.scripts.data.SceneNPC; -import emu.grasscutter.game.world.Position; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityRegion.java b/src/main/java/emu/grasscutter/game/entity/EntityRegion.java index 2fa320f77..2ffca9325 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityRegion.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityRegion.java @@ -1,10 +1,10 @@ package emu.grasscutter.game.entity; import emu.grasscutter.game.props.EntityIdType; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.SceneEntityInfoOuterClass; import emu.grasscutter.scripts.data.SceneRegion; -import emu.grasscutter.game.world.Position; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; diff --git a/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java b/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java index 202760257..88a86cce9 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityVehicle.java @@ -7,6 +7,7 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo; import emu.grasscutter.net.proto.AnimatorParameterValueInfoPairOuterClass.AnimatorParameterValueInfoPair; @@ -21,7 +22,6 @@ import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo; import emu.grasscutter.net.proto.VectorOuterClass.Vector; import emu.grasscutter.net.proto.VehicleInfoOuterClass.VehicleInfo; import emu.grasscutter.net.proto.VehicleMemberOuterClass.VehicleMember; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.helpers.ProtoHelper; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; diff --git a/src/main/java/emu/grasscutter/game/entity/GameEntity.java b/src/main/java/emu/grasscutter/game/entity/GameEntity.java index c77abbbaf..4978c6c6e 100644 --- a/src/main/java/emu/grasscutter/game/entity/GameEntity.java +++ b/src/main/java/emu/grasscutter/game/entity/GameEntity.java @@ -5,6 +5,7 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.LifeState; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.SpawnDataEntry; import emu.grasscutter.game.world.World; @@ -18,7 +19,6 @@ import emu.grasscutter.scripts.data.controller.EntityController; import emu.grasscutter.server.event.entity.EntityDamageEvent; import emu.grasscutter.server.event.entity.EntityDeathEvent; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; -import emu.grasscutter.game.world.Position; import it.unimi.dsi.fastutil.ints.Int2FloatMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/chest/NormalChestInteractHandler.java b/src/main/java/emu/grasscutter/game/entity/gadget/chest/NormalChestInteractHandler.java index 33f2d9be8..ef4599efb 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/chest/NormalChestInteractHandler.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/chest/NormalChestInteractHandler.java @@ -4,7 +4,6 @@ import emu.grasscutter.game.entity.gadget.GadgetChest; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.world.ChestReward; import emu.grasscutter.server.event.player.PlayerOpenChestEvent; - import java.util.Random; public class NormalChestInteractHandler implements ChestInteractHandler { @@ -23,7 +22,8 @@ public class NormalChestInteractHandler implements ChestInteractHandler { public boolean onInteract(GadgetChest chest, Player player) { // Invoke open chest event. var event = new PlayerOpenChestEvent(player, chest, this.chestReward); - event.call(); if (event.isCanceled()) return true; + event.call(); + if (event.isCanceled()) return true; player.earnExp(chestReward.getAdvExp()); player.getInventory().addItem(201, chestReward.getResin()); diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/platform/AbilityRoute.java b/src/main/java/emu/grasscutter/game/entity/gadget/platform/AbilityRoute.java index dda57c522..436fddb19 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/platform/AbilityRoute.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/platform/AbilityRoute.java @@ -1,9 +1,9 @@ package emu.grasscutter.game.entity.gadget.platform; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.MathQuaternionOuterClass.MathQuaternion; import emu.grasscutter.net.proto.MovingPlatformTypeOuterClass; import emu.grasscutter.net.proto.PlatformInfoOuterClass; -import emu.grasscutter.game.world.Position; /** TODO mostly hardcoded for EntitySolarIsotomaElevatorPlatform, should be more generic */ public class AbilityRoute extends BaseRoute { diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java b/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java index 11e08df01..74428294b 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/platform/BaseRoute.java @@ -1,10 +1,10 @@ package emu.grasscutter.game.entity.gadget.platform; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.MathQuaternionOuterClass.MathQuaternion; import emu.grasscutter.net.proto.PlatformInfoOuterClass.PlatformInfo; import emu.grasscutter.scripts.data.SceneGadget; -import emu.grasscutter.game.world.Position; import lombok.Getter; import lombok.Setter; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java b/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java index 91bbf2984..4a4f3d838 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/platform/ConfigRoute.java @@ -1,9 +1,9 @@ package emu.grasscutter.game.entity.gadget.platform; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.MovingPlatformTypeOuterClass; import emu.grasscutter.net.proto.PlatformInfoOuterClass; import emu.grasscutter.scripts.data.SceneGadget; -import emu.grasscutter.game.world.Position; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java b/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java index 48909b549..0642372d5 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/platform/PointArrayRoute.java @@ -1,9 +1,9 @@ package emu.grasscutter.game.entity.gadget.platform; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.MovingPlatformTypeOuterClass; import emu.grasscutter.net.proto.PlatformInfoOuterClass; import emu.grasscutter.scripts.data.SceneGadget; -import emu.grasscutter.game.world.Position; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/emu/grasscutter/game/entity/platform/EntitySolarIsotomaElevatorPlatform.java b/src/main/java/emu/grasscutter/game/entity/platform/EntitySolarIsotomaElevatorPlatform.java index e21783244..bf0113c7d 100644 --- a/src/main/java/emu/grasscutter/game/entity/platform/EntitySolarIsotomaElevatorPlatform.java +++ b/src/main/java/emu/grasscutter/game/entity/platform/EntitySolarIsotomaElevatorPlatform.java @@ -5,8 +5,8 @@ import emu.grasscutter.data.binout.config.ConfigEntityGadget; import emu.grasscutter.game.entity.*; import emu.grasscutter.game.entity.gadget.GadgetAbility; import emu.grasscutter.game.entity.gadget.platform.AbilityRoute; -import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.Position; +import emu.grasscutter.game.world.Scene; public class EntitySolarIsotomaElevatorPlatform extends EntityGadget { @SuppressWarnings("removal") diff --git a/src/main/java/emu/grasscutter/game/home/HomeAnimalItem.java b/src/main/java/emu/grasscutter/game/home/HomeAnimalItem.java index 07239d65d..bf3fe2492 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeAnimalItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeAnimalItem.java @@ -1,8 +1,8 @@ package emu.grasscutter.game.home; import dev.morphia.annotations.Entity; -import emu.grasscutter.net.proto.HomeAnimalDataOuterClass; import emu.grasscutter.game.world.Position; +import emu.grasscutter.net.proto.HomeAnimalDataOuterClass; import lombok.AccessLevel; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java b/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java index 548c1ac0b..a14b41833 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeFurnitureItem.java @@ -4,9 +4,9 @@ import dev.morphia.annotations.Entity; import emu.grasscutter.data.GameData; import emu.grasscutter.data.binout.HomeworldDefaultSaveData; import emu.grasscutter.data.excels.ItemData; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.HomeFurnitureDataOuterClass; import emu.grasscutter.net.proto.HomeMarkPointFurnitureDataOuterClass; -import emu.grasscutter.game.world.Position; import lombok.AccessLevel; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/emu/grasscutter/game/home/HomeNPCItem.java b/src/main/java/emu/grasscutter/game/home/HomeNPCItem.java index f1870046d..cce6fa055 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeNPCItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeNPCItem.java @@ -1,8 +1,8 @@ package emu.grasscutter.game.home; import dev.morphia.annotations.Entity; -import emu.grasscutter.net.proto.HomeNpcDataOuterClass; import emu.grasscutter.game.world.Position; +import emu.grasscutter.net.proto.HomeNpcDataOuterClass; import lombok.AccessLevel; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java index 2c8e2a7a8..d8e22dc4b 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java @@ -4,8 +4,8 @@ import dev.morphia.annotations.Entity; import dev.morphia.annotations.Id; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.binout.HomeworldDefaultSaveData; -import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo; import emu.grasscutter.game.world.Position; +import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo; import java.util.Map; import java.util.stream.Collectors; import lombok.AccessLevel; diff --git a/src/main/java/emu/grasscutter/game/managers/blossom/BlossomActivity.java b/src/main/java/emu/grasscutter/game/managers/blossom/BlossomActivity.java index 34f333e98..d3cd02118 100644 --- a/src/main/java/emu/grasscutter/game/managers/blossom/BlossomActivity.java +++ b/src/main/java/emu/grasscutter/game/managers/blossom/BlossomActivity.java @@ -7,11 +7,11 @@ import emu.grasscutter.game.dungeons.challenge.trigger.KillMonsterCountTrigger; import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityMonster; import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.scripts.data.SceneBossChest; import emu.grasscutter.scripts.data.SceneGadget; import emu.grasscutter.scripts.data.SceneGroup; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.Utils; import java.util.ArrayDeque; import java.util.ArrayList; diff --git a/src/main/java/emu/grasscutter/game/managers/deforestation/DeforestationManager.java b/src/main/java/emu/grasscutter/game/managers/deforestation/DeforestationManager.java index fc70e17d2..9ced9b53e 100644 --- a/src/main/java/emu/grasscutter/game/managers/deforestation/DeforestationManager.java +++ b/src/main/java/emu/grasscutter/game/managers/deforestation/DeforestationManager.java @@ -5,10 +5,10 @@ import emu.grasscutter.data.GameData; import emu.grasscutter.game.entity.EntityItem; import emu.grasscutter.game.player.BasePlayerManager; import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.HitTreeNotifyOuterClass; import emu.grasscutter.net.proto.VectorOuterClass; -import emu.grasscutter.game.world.Position; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java b/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java index c277a975d..9b70c822e 100644 --- a/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java +++ b/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java @@ -17,6 +17,7 @@ import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.MonsterType; import emu.grasscutter.game.props.WeaponType; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.AbilityActionGenerateElemBallOuterClass.AbilityActionGenerateElemBall; import emu.grasscutter.net.proto.AbilityIdentifierOuterClass.AbilityIdentifier; import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry; @@ -25,7 +26,6 @@ import emu.grasscutter.net.proto.ChangeEnergyReasonOuterClass.ChangeEnergyReason import emu.grasscutter.net.proto.EvtBeingHitInfoOuterClass.EvtBeingHitInfo; import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason; import emu.grasscutter.server.game.GameSession; -import emu.grasscutter.game.world.Position; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; diff --git a/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java b/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java index 1c3bc757d..930737bda 100644 --- a/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java +++ b/src/main/java/emu/grasscutter/game/managers/mapmark/MapMark.java @@ -1,10 +1,10 @@ package emu.grasscutter.game.managers.mapmark; import dev.morphia.annotations.Entity; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.MapMarkFromTypeOuterClass.MapMarkFromType; import emu.grasscutter.net.proto.MapMarkPointOuterClass.MapMarkPoint; import emu.grasscutter.net.proto.MapMarkPointTypeOuterClass.MapMarkPointType; -import emu.grasscutter.game.world.Position; @Entity public class MapMark { diff --git a/src/main/java/emu/grasscutter/game/managers/mapmark/MapMarksManager.java b/src/main/java/emu/grasscutter/game/managers/mapmark/MapMarksManager.java index 254f8818d..9b048f425 100644 --- a/src/main/java/emu/grasscutter/game/managers/mapmark/MapMarksManager.java +++ b/src/main/java/emu/grasscutter/game/managers/mapmark/MapMarksManager.java @@ -3,13 +3,13 @@ package emu.grasscutter.game.managers.mapmark; import emu.grasscutter.config.Configuration; import emu.grasscutter.game.player.BasePlayerManager; import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.MapMarkPointTypeOuterClass.MapMarkPointType; import emu.grasscutter.net.proto.MarkMapReqOuterClass.MarkMapReq; import emu.grasscutter.net.proto.MarkMapReqOuterClass.MarkMapReq.Operation; import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType; import emu.grasscutter.server.packet.send.PacketMarkMapRsp; import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify; -import emu.grasscutter.game.world.Position; import java.util.Map; public class MapMarksManager extends BasePlayerManager { diff --git a/src/main/java/emu/grasscutter/game/player/TeamManager.java b/src/main/java/emu/grasscutter/game/player/TeamManager.java index 4aaff8176..b2c756576 100644 --- a/src/main/java/emu/grasscutter/game/player/TeamManager.java +++ b/src/main/java/emu/grasscutter/game/player/TeamManager.java @@ -14,6 +14,7 @@ import emu.grasscutter.game.entity.EntityBaseGadget; import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.EnterReason; import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.World; import emu.grasscutter.net.packet.BasePacket; @@ -26,7 +27,6 @@ import emu.grasscutter.net.proto.TrialAvatarGrantRecordOuterClass.TrialAvatarGra import emu.grasscutter.net.proto.VisionTypeOuterClass; import emu.grasscutter.server.event.player.PlayerTeamDeathEvent; import emu.grasscutter.server.packet.send.*; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; diff --git a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java index 214e7d65e..ce7355f32 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java @@ -16,6 +16,7 @@ import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.quest.enums.*; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.ChildQuestOuterClass.ChildQuest; import emu.grasscutter.net.proto.ParentQuestOuterClass.ParentQuest; import emu.grasscutter.server.packet.send.PacketCodexDataUpdateNotify; @@ -23,7 +24,6 @@ import emu.grasscutter.server.packet.send.PacketFinishedParentQuestUpdateNotify; import emu.grasscutter.server.packet.send.PacketQuestProgressUpdateNotify; import emu.grasscutter.server.packet.send.PacketQuestUpdateQuestVarNotify; import emu.grasscutter.utils.ConversionUtils; -import emu.grasscutter.game.world.Position; import java.util.*; import java.util.stream.Collectors; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/game/world/GridPosition.java b/src/main/java/emu/grasscutter/game/world/GridPosition.java index 4261bf33c..a6ba36891 100644 --- a/src/main/java/emu/grasscutter/game/world/GridPosition.java +++ b/src/main/java/emu/grasscutter/game/world/GridPosition.java @@ -2,13 +2,12 @@ package emu.grasscutter.game.world; import com.github.davidmoten.rtreemulti.geometry.Point; import dev.morphia.annotations.Entity; -import lombok.Getter; -import lombok.Setter; -import lombok.SneakyThrows; - import java.io.IOException; import java.io.Serializable; import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.SneakyThrows; @Entity public final class GridPosition implements Serializable { diff --git a/src/main/java/emu/grasscutter/game/world/Position.java b/src/main/java/emu/grasscutter/game/world/Position.java index 29da3680d..1a0d5bd8c 100644 --- a/src/main/java/emu/grasscutter/game/world/Position.java +++ b/src/main/java/emu/grasscutter/game/world/Position.java @@ -5,11 +5,10 @@ import com.google.gson.annotations.SerializedName; import dev.morphia.annotations.Entity; import emu.grasscutter.net.proto.VectorOuterClass.Vector; import emu.grasscutter.utils.Utils; -import lombok.Getter; -import lombok.Setter; - import java.io.Serializable; import java.util.List; +import lombok.Getter; +import lombok.Setter; @Entity public class Position implements Serializable { diff --git a/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java b/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java index 1c5ad8c0f..a35a00e2c 100644 --- a/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java +++ b/src/main/java/emu/grasscutter/game/world/SpawnDataEntry.java @@ -1,7 +1,6 @@ package emu.grasscutter.game.world; import emu.grasscutter.data.GameDepot; - import java.util.List; import java.util.Objects; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/game/world/data/TeleportProperties.java b/src/main/java/emu/grasscutter/game/world/data/TeleportProperties.java index 136a716f4..93c91c2d3 100644 --- a/src/main/java/emu/grasscutter/game/world/data/TeleportProperties.java +++ b/src/main/java/emu/grasscutter/game/world/data/TeleportProperties.java @@ -1,9 +1,9 @@ package emu.grasscutter.game.world.data; import emu.grasscutter.game.props.EnterReason; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.EnterTypeOuterClass; import emu.grasscutter.server.event.player.PlayerTeleportEvent; -import emu.grasscutter.game.world.Position; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java b/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java index b4457a360..4e13ebac4 100644 --- a/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java +++ b/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java @@ -5,12 +5,12 @@ import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.EnterReason; import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType; import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; import emu.grasscutter.server.packet.send.PacketPlayerEnterSceneNotify; -import emu.grasscutter.game.world.Position; /** Hooks into the {@link Player} class, adding convenient ways to do certain things. */ public interface PlayerHook { diff --git a/src/main/java/emu/grasscutter/plugin/api/ServerHelper.java b/src/main/java/emu/grasscutter/plugin/api/ServerHelper.java index a1fcb66f5..bc3ac7cc9 100644 --- a/src/main/java/emu/grasscutter/plugin/api/ServerHelper.java +++ b/src/main/java/emu/grasscutter/plugin/api/ServerHelper.java @@ -11,7 +11,6 @@ import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.http.HttpServer; import emu.grasscutter.server.http.Router; import emu.grasscutter.server.scheduler.ServerTaskScheduler; - import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; @@ -136,8 +135,7 @@ public class ServerHelper { * @return The server's task scheduler. */ public ServerTaskScheduler getScheduler() { - if (this.getGameServer() == null) - return null; + if (this.getGameServer() == null) return null; return this.getGameServer().getScheduler(); } diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 8e8f7cffe..51a4ec17a 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -13,6 +13,8 @@ import emu.grasscutter.game.entity.gadget.platform.BaseRoute; import emu.grasscutter.game.props.EntityType; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestGroupSuite; +import emu.grasscutter.game.world.GridPosition; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.SceneGroupInstance; import emu.grasscutter.net.proto.VisionTypeOuterClass; @@ -22,9 +24,7 @@ import emu.grasscutter.scripts.service.ScriptMonsterSpawnService; import emu.grasscutter.scripts.service.ScriptMonsterTideService; import emu.grasscutter.server.packet.send.PacketGroupSuiteNotify; import emu.grasscutter.utils.FileUtils; -import emu.grasscutter.game.world.GridPosition; import emu.grasscutter.utils.JsonUtils; -import emu.grasscutter.game.world.Position; import io.netty.util.concurrent.FastThreadLocalThread; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java b/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java index ac0383fc7..b99390c59 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneBlock.java @@ -4,9 +4,9 @@ import com.github.davidmoten.rtreemulti.RTree; import com.github.davidmoten.rtreemulti.geometry.Geometry; import com.github.davidmoten.rtreemulti.geometry.Rectangle; import emu.grasscutter.Grasscutter; +import emu.grasscutter.game.world.Position; import emu.grasscutter.scripts.SceneIndexManager; import emu.grasscutter.scripts.ScriptLoader; -import emu.grasscutter.game.world.Position; import java.util.Map; import java.util.stream.Collectors; import javax.script.Bindings; diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java b/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java index 20fd5a9a5..78965c572 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneGroup.java @@ -1,8 +1,8 @@ package emu.grasscutter.scripts.data; import emu.grasscutter.Grasscutter; -import emu.grasscutter.scripts.ScriptLoader; import emu.grasscutter.game.world.Position; +import emu.grasscutter.scripts.ScriptLoader; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java b/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java index 5db984149..97e7efef7 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java @@ -1,7 +1,7 @@ package emu.grasscutter.scripts.data; -import emu.grasscutter.scripts.constants.ScriptRegionShape; import emu.grasscutter.game.world.Position; +import emu.grasscutter.scripts.constants.ScriptRegionShape; import java.util.List; import lombok.EqualsAndHashCode; import lombok.Setter; diff --git a/src/main/java/emu/grasscutter/server/event/EventHandler.java b/src/main/java/emu/grasscutter/server/event/EventHandler.java index e9b29e33f..a28d2e1a3 100644 --- a/src/main/java/emu/grasscutter/server/event/EventHandler.java +++ b/src/main/java/emu/grasscutter/server/event/EventHandler.java @@ -7,49 +7,52 @@ import emu.grasscutter.utils.objects.EventConsumer; public final class EventHandler { /** * Create and register a new event handler. + * * @param plugin The plugin handling the event. * @param eventClass The event class. * @param listener The event handler function. */ - public static void newHandler(Plugin plugin, - Class eventClass, EventConsumer listener - ) { + public static void newHandler( + Plugin plugin, Class eventClass, EventConsumer listener) { new EventHandler<>(eventClass) - .priority(HandlerPriority.NORMAL) - .listener(listener).register(plugin); + .priority(HandlerPriority.NORMAL) + .listener(listener) + .register(plugin); } /** * Create and register a new event handler. + * * @param plugin The plugin handling the event. * @param eventClass The event class. * @param listener The event handler function. * @param priority The handler's priority. */ - public static void newHandler(Plugin plugin, - Class eventClass, EventConsumer listener, - HandlerPriority priority - ) { - new EventHandler<>(eventClass) - .listener(listener).priority(priority) - .register(plugin); + public static void newHandler( + Plugin plugin, Class eventClass, EventConsumer listener, HandlerPriority priority) { + new EventHandler<>(eventClass).listener(listener).priority(priority).register(plugin); } /** * Create and register a new event handler. + * * @param plugin The plugin handling the event. * @param eventClass The event class. * @param listener The event handler function. * @param priority The handler's priority. * @param handleCanceled Should this handler execute on canceled events? */ - public static void newHandler(Plugin plugin, - Class eventClass, EventConsumer listener, - HandlerPriority priority, boolean handleCanceled - ) { + public static void newHandler( + Plugin plugin, + Class eventClass, + EventConsumer listener, + HandlerPriority priority, + boolean handleCanceled) { new EventHandler<>(eventClass) - .listener(listener).priority(priority) - .ignore(handleCanceled).register(plugin); + .listener(listener) + .priority(priority) + .ignore(handleCanceled) + .register(plugin); } private final Class eventClass; diff --git a/src/main/java/emu/grasscutter/server/event/entity/EntityDeathEvent.java b/src/main/java/emu/grasscutter/server/event/entity/EntityDeathEvent.java index 66c41a3c0..2f6c3c1df 100644 --- a/src/main/java/emu/grasscutter/server/event/entity/EntityDeathEvent.java +++ b/src/main/java/emu/grasscutter/server/event/entity/EntityDeathEvent.java @@ -1,8 +1,8 @@ package emu.grasscutter.server.event.entity; import emu.grasscutter.game.entity.GameEntity; -import emu.grasscutter.server.event.types.EntityEvent; import emu.grasscutter.game.world.Location; +import emu.grasscutter.server.event.types.EntityEvent; import javax.annotation.Nullable; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/server/event/entity/EntityMoveEvent.java b/src/main/java/emu/grasscutter/server/event/entity/EntityMoveEvent.java index 8e9816ae4..7c0bcc54f 100644 --- a/src/main/java/emu/grasscutter/server/event/entity/EntityMoveEvent.java +++ b/src/main/java/emu/grasscutter/server/event/entity/EntityMoveEvent.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.event.entity; import emu.grasscutter.game.entity.GameEntity; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.proto.MotionStateOuterClass.MotionState; import emu.grasscutter.server.event.types.EntityEvent; -import emu.grasscutter.game.world.Position; public final class EntityMoveEvent extends EntityEvent { private final Position position, rotation; diff --git a/src/main/java/emu/grasscutter/server/event/player/PlayerChatEvent.java b/src/main/java/emu/grasscutter/server/event/player/PlayerChatEvent.java index ccf79ef4e..e5d03cab3 100644 --- a/src/main/java/emu/grasscutter/server/event/player/PlayerChatEvent.java +++ b/src/main/java/emu/grasscutter/server/event/player/PlayerChatEvent.java @@ -3,24 +3,24 @@ package emu.grasscutter.server.event.player; import emu.grasscutter.game.player.Player; import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.types.PlayerEvent; +import javax.annotation.Nullable; import lombok.Getter; import lombok.Setter; -import javax.annotation.Nullable; - -@Getter @Setter +@Getter +@Setter public final class PlayerChatEvent extends PlayerEvent implements Cancellable { private String message; /** - * This field being null signifies a message is being sent to a public chat. - * This can include either a global chat or a team chat. + * This field being null signifies a message is being sent to a public chat. This can include + * either a global chat or a team chat. */ @Nullable private Player to; /** - * This field is not null when the message is being sent to a public chat. - * Refer to {@link #to} for more information. + * This field is not null when the message is being sent to a public chat. Refer to {@link #to} + * for more information. */ @Nullable private Integer channelId; diff --git a/src/main/java/emu/grasscutter/server/event/player/PlayerMoveEvent.java b/src/main/java/emu/grasscutter/server/event/player/PlayerMoveEvent.java index ba4069d70..fc5ec338f 100644 --- a/src/main/java/emu/grasscutter/server/event/player/PlayerMoveEvent.java +++ b/src/main/java/emu/grasscutter/server/event/player/PlayerMoveEvent.java @@ -1,8 +1,8 @@ package emu.grasscutter.server.event.player; import emu.grasscutter.game.player.Player; -import emu.grasscutter.server.event.types.PlayerEvent; import emu.grasscutter.game.world.Position; +import emu.grasscutter.server.event.types.PlayerEvent; public final class PlayerMoveEvent extends PlayerEvent { private final MoveType type; diff --git a/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java b/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java index c87572af1..e397ff33b 100644 --- a/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java +++ b/src/main/java/emu/grasscutter/server/event/player/PlayerOpenChestEvent.java @@ -10,9 +10,7 @@ public final class PlayerOpenChestEvent extends PlayerEvent implements Cancellab private final GadgetChest chest; private ChestReward reward; - public PlayerOpenChestEvent(Player player, - GadgetChest chest, ChestReward reward - ) { + public PlayerOpenChestEvent(Player player, GadgetChest chest, ChestReward reward) { super(player); this.chest = chest; diff --git a/src/main/java/emu/grasscutter/server/event/player/PlayerTeleportEvent.java b/src/main/java/emu/grasscutter/server/event/player/PlayerTeleportEvent.java index cd62c24a2..15b00d8d3 100644 --- a/src/main/java/emu/grasscutter/server/event/player/PlayerTeleportEvent.java +++ b/src/main/java/emu/grasscutter/server/event/player/PlayerTeleportEvent.java @@ -1,10 +1,10 @@ package emu.grasscutter.server.event.player; import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.data.TeleportProperties; import emu.grasscutter.server.event.Cancellable; import emu.grasscutter.server.event.types.PlayerEvent; -import emu.grasscutter.game.world.Position; public final class PlayerTeleportEvent extends PlayerEvent implements Cancellable { private final TeleportProperties properties; diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index 35ad44ab5..1124373c1 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.lang.Language.translate; + import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter.ServerRunMode; @@ -37,23 +41,18 @@ 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 org.jetbrains.annotations.NotNull; - 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.lang.Language.translate; +import kcp.highway.ChannelConfig; +import kcp.highway.KcpServer; +import lombok.Getter; +import lombok.Setter; +import lombok.SneakyThrows; +import org.jetbrains.annotations.NotNull; @Getter public final class GameServer extends KcpServer implements Iterable { @@ -355,8 +354,7 @@ public final class GameServer extends KcpServer implements Iterable { getWorlds().forEach(World::save); } - @NotNull - @Override + @NotNull @Override public Iterator iterator() { return this.getPlayers().values().iterator(); } diff --git a/src/main/java/emu/grasscutter/server/game/GameSession.java b/src/main/java/emu/grasscutter/server/game/GameSession.java index 4b5bee4bc..848609a25 100644 --- a/src/main/java/emu/grasscutter/server/game/GameSession.java +++ b/src/main/java/emu/grasscutter/server/game/GameSession.java @@ -1,5 +1,9 @@ package emu.grasscutter.server.game; +import static emu.grasscutter.config.Configuration.GAME_INFO; +import static emu.grasscutter.config.Configuration.SERVER; +import static emu.grasscutter.utils.lang.Language.translate; + import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter.ServerDebugMode; import emu.grasscutter.game.Account; @@ -13,16 +17,11 @@ import emu.grasscutter.utils.FileUtils; import emu.grasscutter.utils.Utils; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import lombok.Getter; -import lombok.Setter; - import java.io.File; import java.net.InetSocketAddress; import java.nio.file.Path; - -import static emu.grasscutter.config.Configuration.GAME_INFO; -import static emu.grasscutter.config.Configuration.SERVER; -import static emu.grasscutter.utils.lang.Language.translate; +import lombok.Getter; +import lombok.Setter; public class GameSession implements GameSessionManager.KcpChannel { private final GameServer server; diff --git a/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java b/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java index d882aae7c..ceea72955 100644 --- a/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java +++ b/src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java @@ -1,14 +1,13 @@ package emu.grasscutter.server.http.documentation; +import static emu.grasscutter.config.Configuration.DOCUMENT_LANGUAGE; + import emu.grasscutter.tools.Tools; import emu.grasscutter.utils.lang.Language; import io.javalin.http.ContentType; import io.javalin.http.Context; - import java.util.List; -import static emu.grasscutter.config.Configuration.DOCUMENT_LANGUAGE; - final class GachaMappingRequestHandler implements DocumentationHandler { private final List gachaJsons; diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java index a03795d42..aa7219794 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java @@ -4,6 +4,7 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; @@ -19,7 +20,6 @@ import emu.grasscutter.net.proto.PlayerDieTypeOuterClass; import emu.grasscutter.server.event.entity.EntityMoveEvent; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; -import emu.grasscutter.game.world.Position; @Opcodes(PacketOpcodes.CombatInvocationsNotify) public class HandlerCombatInvocationsNotify extends PacketHandler { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCreateVehicleReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCreateVehicleReq.java index a164914d6..8f3808734 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCreateVehicleReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCreateVehicleReq.java @@ -1,12 +1,12 @@ package emu.grasscutter.server.packet.recv; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CreateVehicleReqOuterClass; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketCreateVehicleRsp; -import emu.grasscutter.game.world.Position; @Opcodes(PacketOpcodes.CreateVehicleReq) public class HandlerCreateVehicleReq extends PacketHandler { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java index 2e6d9f09b..b77f7cb03 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java @@ -13,10 +13,10 @@ import emu.grasscutter.server.event.game.PlayerCreationEvent; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession.SessionState; import emu.grasscutter.server.packet.send.PacketGetPlayerTokenRsp; -import emu.grasscutter.utils.helpers.ByteHelper; import emu.grasscutter.utils.Crypto; import emu.grasscutter.utils.DispatchUtils; import emu.grasscutter.utils.Utils; +import emu.grasscutter.utils.helpers.ByteHelper; import java.nio.ByteBuffer; import java.security.Signature; import javax.crypto.Cipher; diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeModuleReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeModuleReq.java index 98dcb579e..ddf168b6d 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeModuleReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeModuleReq.java @@ -1,5 +1,6 @@ package emu.grasscutter.server.packet.recv; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; @@ -10,7 +11,6 @@ import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketHomeChangeModuleRsp; import emu.grasscutter.server.packet.send.PacketHomeComfortInfoNotify; import emu.grasscutter.server.packet.send.PacketPlayerHomeCompInfoNotify; -import emu.grasscutter.game.world.Position; @Opcodes(PacketOpcodes.HomeChangeModuleReq) public class HandlerHomeChangeModuleReq extends PacketHandler { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeSceneJumpReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeSceneJumpReq.java index 8606ded54..b87968793 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeSceneJumpReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeSceneJumpReq.java @@ -1,5 +1,6 @@ package emu.grasscutter.server.packet.recv; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; @@ -7,7 +8,6 @@ import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.HomeSceneJumpReqOuterClass; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketHomeSceneJumpRsp; -import emu.grasscutter.game.world.Position; @Opcodes(PacketOpcodes.HomeSceneJumpReq) public class HandlerHomeSceneJumpReq extends PacketHandler { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPersonalSceneJumpReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPersonalSceneJumpReq.java index 46605ee5f..6448b9a62 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPersonalSceneJumpReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPersonalSceneJumpReq.java @@ -2,13 +2,13 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.data.GameData; import emu.grasscutter.data.binout.ScenePointEntry; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PersonalSceneJumpReqOuterClass.PersonalSceneJumpReq; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketPersonalSceneJumpRsp; -import emu.grasscutter.game.world.Position; @Opcodes(PacketOpcodes.PersonalSceneJumpReq) public class HandlerPersonalSceneJumpReq extends PacketHandler { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestCreateEntityReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestCreateEntityReq.java index dc270f30b..66462c97a 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestCreateEntityReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestCreateEntityReq.java @@ -5,13 +5,13 @@ import emu.grasscutter.data.excels.GadgetData; import emu.grasscutter.data.excels.ItemData; import emu.grasscutter.data.excels.monster.MonsterData; import emu.grasscutter.game.entity.*; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.QuestCreateEntityReqOuterClass.QuestCreateEntityReq; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketQuestCreateEntityRsp; -import emu.grasscutter.game.world.Position; import lombok.val; @Opcodes(PacketOpcodes.QuestCreateEntityReq) diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestTransmitReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestTransmitReq.java index c87ce185a..4dd93f524 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestTransmitReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestTransmitReq.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.data.GameData; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.QuestTransmitReqOuterClass.QuestTransmitReq; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketQuestTransmitRsp; -import emu.grasscutter.game.world.Position; import java.util.ArrayList; @Opcodes(PacketOpcodes.QuestTransmitReq) diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTryEnterHomeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTryEnterHomeReq.java index 16639832e..2f29e3826 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTryEnterHomeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTryEnterHomeReq.java @@ -1,6 +1,7 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.game.home.GameHome; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; @@ -11,7 +12,6 @@ import emu.grasscutter.net.proto.TryEnterHomeReqOuterClass; import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketTryEnterHomeRsp; -import emu.grasscutter.game.world.Position; @Opcodes(PacketOpcodes.TryEnterHomeReq) public class HandlerTryEnterHomeReq extends PacketHandler { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java index de192c2d4..25bb1d2e1 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java @@ -1,6 +1,7 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.game.entity.EntityVehicle; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; @@ -9,7 +10,6 @@ import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketWidgetCoolDownNotify; import emu.grasscutter.server.packet.send.PacketWidgetDoBagRsp; import emu.grasscutter.server.packet.send.PacketWidgetGadgetDataNotify; -import emu.grasscutter.game.world.Position; @Opcodes(PacketOpcodes.WidgetDoBagReq) public class HandlerWidgetDoBagReq extends PacketHandler { diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketBeginCameraSceneLookNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketBeginCameraSceneLookNotify.java index 85fe253ec..c29ea18ac 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketBeginCameraSceneLookNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketBeginCameraSceneLookNotify.java @@ -1,14 +1,13 @@ package emu.grasscutter.server.packet.send; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.BeginCameraSceneLookNotifyOuterClass.BeginCameraSceneLookNotify; -import emu.grasscutter.game.world.Position; -import lombok.Data; -import lombok.NoArgsConstructor; - import java.util.ArrayList; import java.util.Collection; +import lombok.Data; +import lombok.NoArgsConstructor; public final class PacketBeginCameraSceneLookNotify extends BasePacket { @@ -16,21 +15,21 @@ public final class PacketBeginCameraSceneLookNotify extends BasePacket { super(PacketOpcodes.BeginCameraSceneLookNotify); var packet = - BeginCameraSceneLookNotify.newBuilder() - .setLookPos(parameters.lookPos.toProto()) - .setFollowPos(parameters.followPos.toProto()) - .setDuration(parameters.duration) - .setIsAllowInput(parameters.isAllowInput) - .setIsSetFollowPos(parameters.setFollowPos) - .setIsSetScreenXy(parameters.isScreenXY) - .setIsRecoverKeepCurrent(parameters.recoverKeepCurrent) - .setIsChangePlayMode(parameters.isChangePlayMode) - .setScreenY(parameters.screenY) - .setScreenX(parameters.screenX) - .setIsForce(parameters.isForce) - .setIsForce(parameters.isForceWalk) - .setEntityId(parameters.entityId) - .addAllOtherParams(parameters.otherParams); + BeginCameraSceneLookNotify.newBuilder() + .setLookPos(parameters.lookPos.toProto()) + .setFollowPos(parameters.followPos.toProto()) + .setDuration(parameters.duration) + .setIsAllowInput(parameters.isAllowInput) + .setIsSetFollowPos(parameters.setFollowPos) + .setIsSetScreenXy(parameters.isScreenXY) + .setIsRecoverKeepCurrent(parameters.recoverKeepCurrent) + .setIsChangePlayMode(parameters.isChangePlayMode) + .setScreenY(parameters.screenY) + .setScreenX(parameters.screenX) + .setIsForce(parameters.isForce) + .setIsForce(parameters.isForceWalk) + .setEntityId(parameters.entityId) + .addAllOtherParams(parameters.otherParams); this.setData(packet); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java index e5eae2782..873e69b86 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java @@ -3,12 +3,12 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.entity.EntityVehicle; import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.CreateVehicleRspOuterClass.CreateVehicleRsp; import emu.grasscutter.net.proto.VehicleInteractTypeOuterClass; import emu.grasscutter.net.proto.VehicleMemberOuterClass.VehicleMember; -import emu.grasscutter.game.world.Position; import java.util.List; public class PacketCreateVehicleRsp extends BasePacket { diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPersonalSceneJumpRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPersonalSceneJumpRsp.java index aa2ea9a08..9a4e96c99 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPersonalSceneJumpRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPersonalSceneJumpRsp.java @@ -1,9 +1,9 @@ package emu.grasscutter.server.packet.send; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PersonalSceneJumpRspOuterClass.PersonalSceneJumpRsp; -import emu.grasscutter.game.world.Position; public class PacketPersonalSceneJumpRsp extends BasePacket { diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java index 0c68b8409..145c8cab1 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java @@ -3,12 +3,12 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player.SceneLoadState; import emu.grasscutter.game.props.EnterReason; +import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.data.TeleportProperties; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType; import emu.grasscutter.net.proto.PlayerEnterSceneNotifyOuterClass.PlayerEnterSceneNotify; -import emu.grasscutter.game.world.Position; import emu.grasscutter.utils.Utils; public class PacketPlayerEnterSceneNotify extends BasePacket { diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerSoundNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerSoundNotify.java index 20e57e87e..f5ca35580 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerSoundNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerSoundNotify.java @@ -1,11 +1,11 @@ package emu.grasscutter.server.packet.send; +import emu.grasscutter.game.world.Position; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.ScenePlayerSoundNotifyOuterClass.ScenePlayerSoundNotify; import emu.grasscutter.net.proto.ScenePlayerSoundNotifyOuterClass.ScenePlayerSoundNotify.PlaySoundType; import emu.grasscutter.net.proto.VectorOuterClass.Vector; -import emu.grasscutter.game.world.Position; import java.util.Objects; public class PacketScenePlayerSoundNotify extends BasePacket { diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWindSeedClientNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWindSeedClientNotify.java index c207d80e5..d29c54a95 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWindSeedClientNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWindSeedClientNotify.java @@ -14,9 +14,8 @@ public final class PacketWindSeedClientNotify extends BasePacket { public PacketWindSeedClientNotify(byte[] compiledLua) { super(PacketOpcodes.WindSeedType1Notify); - var packet = WindSeedType1Notify.newBuilder() - .setPayload(ByteString.copyFrom(compiledLua)) - .build(); + var packet = + WindSeedType1Notify.newBuilder().setPayload(ByteString.copyFrom(compiledLua)).build(); this.setData(packet); } diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index 57010ae0a..ba51bce00 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -1,5 +1,8 @@ package emu.grasscutter.tools; +import static emu.grasscutter.utils.FileUtils.getResourcePath; +import static emu.grasscutter.utils.lang.Language.getTextMapKey; + import emu.grasscutter.GameConstants; import emu.grasscutter.Grasscutter; import emu.grasscutter.command.CommandHandler; @@ -17,10 +20,6 @@ import emu.grasscutter.utils.lang.Language; import emu.grasscutter.utils.lang.Language.TextStrings; import it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap; import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.val; - import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -32,9 +31,9 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.LongStream; - -import static emu.grasscutter.utils.FileUtils.getResourcePath; -import static emu.grasscutter.utils.lang.Language.getTextMapKey; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.val; public final class Tools { /** diff --git a/src/main/java/emu/grasscutter/utils/JsonAdapters.java b/src/main/java/emu/grasscutter/utils/JsonAdapters.java index 572577e77..ead308018 100644 --- a/src/main/java/emu/grasscutter/utils/JsonAdapters.java +++ b/src/main/java/emu/grasscutter/utils/JsonAdapters.java @@ -13,13 +13,12 @@ import emu.grasscutter.game.world.Position; import it.unimi.dsi.fastutil.floats.FloatArrayList; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; -import lombok.val; - import java.io.IOException; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.Objects; +import lombok.val; public interface JsonAdapters { class DynamicFloatAdapter extends TypeAdapter { @@ -40,18 +39,19 @@ public interface JsonAdapters { val opStack = new ArrayList(); while (reader.hasNext()) { opStack.add( - switch (reader.peek()) { - case STRING -> new DynamicFloat.StackOp(reader.nextString()); - case NUMBER -> new DynamicFloat.StackOp((float) reader.nextDouble()); - case BOOLEAN -> new DynamicFloat.StackOp(reader.nextBoolean()); - default -> throw new IOException( - "Invalid DynamicFloat definition - " + reader.peek().name()); - }); + switch (reader.peek()) { + case STRING -> new DynamicFloat.StackOp(reader.nextString()); + case NUMBER -> new DynamicFloat.StackOp((float) reader.nextDouble()); + case BOOLEAN -> new DynamicFloat.StackOp(reader.nextBoolean()); + default -> throw new IOException( + "Invalid DynamicFloat definition - " + reader.peek().name()); + }); } reader.endArray(); return new DynamicFloat(opStack); } - default -> throw new IOException("Invalid DynamicFloat definition - " + reader.peek().name()); + default -> throw new IOException( + "Invalid DynamicFloat definition - " + reader.peek().name()); } } @@ -78,7 +78,7 @@ public interface JsonAdapters { public void write(JsonWriter writer, IntList l) throws IOException { writer.beginArray(); for (val i : l) // .forEach() doesn't appreciate exceptions - writer.value(i); + writer.value(i); writer.endArray(); } } diff --git a/src/main/java/emu/grasscutter/utils/StartupArguments.java b/src/main/java/emu/grasscutter/utils/StartupArguments.java index 0f12d21fd..cfcfcbc16 100644 --- a/src/main/java/emu/grasscutter/utils/StartupArguments.java +++ b/src/main/java/emu/grasscutter/utils/StartupArguments.java @@ -1,18 +1,17 @@ package emu.grasscutter.utils; +import static emu.grasscutter.config.Configuration.*; + import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import emu.grasscutter.BuildConfig; import emu.grasscutter.Grasscutter; import emu.grasscutter.net.packet.PacketOpcodesUtils; import emu.grasscutter.tools.Dumpers; -import org.slf4j.LoggerFactory; - import java.util.HashMap; import java.util.Map; import java.util.function.Function; - -import static emu.grasscutter.config.Configuration.*; +import org.slf4j.LoggerFactory; /** A parser for start-up arguments. */ public interface StartupArguments { diff --git a/src/main/java/emu/grasscutter/utils/TsvUtils.java b/src/main/java/emu/grasscutter/utils/TsvUtils.java index 35c32a898..53f236037 100644 --- a/src/main/java/emu/grasscutter/utils/TsvUtils.java +++ b/src/main/java/emu/grasscutter/utils/TsvUtils.java @@ -1,5 +1,7 @@ package emu.grasscutter.utils; +import static emu.grasscutter.utils.Utils.nonRegexSplit; + import com.google.gson.*; import com.google.gson.annotations.SerializedName; import emu.grasscutter.Grasscutter; @@ -7,8 +9,6 @@ import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap; import it.unimi.dsi.fastutil.ints.Int2ObjectSortedMap; import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; -import lombok.val; - import java.io.IOException; import java.lang.reflect.*; import java.nio.charset.StandardCharsets; @@ -19,8 +19,7 @@ import java.util.*; import java.util.function.Function; import java.util.stream.IntStream; import java.util.stream.Stream; - -import static emu.grasscutter.utils.Utils.nonRegexSplit; +import lombok.val; // Throughout this file, commented System.out.println debug log calls are left in. // This is because the default logger will deadlock when operating on parallel streams. diff --git a/src/main/java/emu/grasscutter/utils/lang/Language.java b/src/main/java/emu/grasscutter/utils/lang/Language.java index c9caca5f3..4bd6077d3 100644 --- a/src/main/java/emu/grasscutter/utils/lang/Language.java +++ b/src/main/java/emu/grasscutter/utils/lang/Language.java @@ -1,5 +1,9 @@ package emu.grasscutter.utils.lang; +import static emu.grasscutter.config.Configuration.FALLBACK_LANGUAGE; +import static emu.grasscutter.utils.FileUtils.getCachePath; +import static emu.grasscutter.utils.FileUtils.getResourcePath; + import com.google.gson.JsonElement; import com.google.gson.JsonObject; import emu.grasscutter.Grasscutter; @@ -15,8 +19,6 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import lombok.EqualsAndHashCode; - import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -28,10 +30,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.IntStream; - -import static emu.grasscutter.config.Configuration.FALLBACK_LANGUAGE; -import static emu.grasscutter.utils.FileUtils.getCachePath; -import static emu.grasscutter.utils.FileUtils.getResourcePath; +import lombok.EqualsAndHashCode; public final class Language { private static final Map cachedLanguages = new ConcurrentHashMap<>(); diff --git a/src/main/java/emu/grasscutter/utils/objects/text/Style.java b/src/main/java/emu/grasscutter/utils/objects/text/Style.java index 62ebc8125..452a9e883 100644 --- a/src/main/java/emu/grasscutter/utils/objects/text/Style.java +++ b/src/main/java/emu/grasscutter/utils/objects/text/Style.java @@ -1,11 +1,10 @@ package emu.grasscutter.utils.objects.text; -import lombok.Builder; -import lombok.Data; - import java.awt.*; import java.util.HashMap; import java.util.Map; +import lombok.Builder; +import lombok.Data; /* Text style container. */ @Builder diff --git a/src/main/java/emu/grasscutter/utils/objects/text/Text.java b/src/main/java/emu/grasscutter/utils/objects/text/Text.java index f5e6a75d4..09d97491a 100644 --- a/src/main/java/emu/grasscutter/utils/objects/text/Text.java +++ b/src/main/java/emu/grasscutter/utils/objects/text/Text.java @@ -1,10 +1,9 @@ package emu.grasscutter.utils.objects.text; +import java.awt.*; import lombok.Getter; import lombok.Setter; -import java.awt.*; - /* An instance of text. */ public final class Text { /**