Format code [skip actions]

This commit is contained in:
github-actions 2023-05-20 07:47:53 +00:00
parent 44d467b5d6
commit bbd201c90e
83 changed files with 199 additions and 216 deletions

View File

@ -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");

View File

@ -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 = {"[<sceneId>]"},

View File

@ -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(

View File

@ -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;

View File

@ -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;

View File

@ -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(

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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());

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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")

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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();
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -7,49 +7,52 @@ import emu.grasscutter.utils.objects.EventConsumer;
public final class EventHandler<T extends Event> {
/**
* 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 <T extends Event> void newHandler(Plugin plugin,
Class<T> eventClass, EventConsumer<T> listener
) {
public static <T extends Event> void newHandler(
Plugin plugin, Class<T> eventClass, EventConsumer<T> 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 <T extends Event> void newHandler(Plugin plugin,
Class<T> eventClass, EventConsumer<T> listener,
HandlerPriority priority
) {
new EventHandler<>(eventClass)
.listener(listener).priority(priority)
.register(plugin);
public static <T extends Event> void newHandler(
Plugin plugin, Class<T> eventClass, EventConsumer<T> 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 <T extends Event> void newHandler(Plugin plugin,
Class<T> eventClass, EventConsumer<T> listener,
HandlerPriority priority, boolean handleCanceled
) {
public static <T extends Event> void newHandler(
Plugin plugin,
Class<T> eventClass,
EventConsumer<T> 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<T> eventClass;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<Player> {
@ -355,8 +354,7 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
getWorlds().forEach(World::save);
}
@NotNull
@Override
@NotNull @Override
public Iterator<Player> iterator() {
return this.getPlayers().values().iterator();
}

View File

@ -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;

View File

@ -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<String> gachaJsons;

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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)

View File

@ -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)

View File

@ -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 {

View File

@ -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 {

View File

@ -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);
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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);
}

View File

@ -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 {
/**

View File

@ -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<DynamicFloat> {
@ -40,18 +39,19 @@ public interface JsonAdapters {
val opStack = new ArrayList<DynamicFloat.StackOp>();
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();
}
}

View File

@ -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 {

View File

@ -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.

View File

@ -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<String, Language> cachedLanguages = new ConcurrentHashMap<>();

View File

@ -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

View File

@ -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 {
/**