From 9c25060c7885cde81815fccf4d26b930d850601a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 Sep 2023 05:48:12 +0000 Subject: [PATCH] Format code [skip actions] --- .../java/emu/grasscutter/data/GameData.java | 3 +-- .../game/entity/EntityHomeAnimal.java | 17 +++++++------- .../emu/grasscutter/game/home/HomeScene.java | 19 +++++++-------- .../grasscutter/game/home/HomeSceneItem.java | 23 +++++++++++-------- .../emu/grasscutter/game/home/HomeWorld.java | 1 - .../emu/grasscutter/game/world/Scene.java | 9 ++++---- .../grasscutter/server/game/GameServer.java | 1 - .../recv/HandlerEntityAiKillSelfNotify.java | 3 ++- .../recv/HandlerHomeChangeEditModeReq.java | 8 ++++++- .../HandlerHomeEnterEditModeFinishReq.java | 6 ++++- 10 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/GameData.java b/src/main/java/emu/grasscutter/data/GameData.java index e3394de82..400cade1e 100644 --- a/src/main/java/emu/grasscutter/data/GameData.java +++ b/src/main/java/emu/grasscutter/data/GameData.java @@ -48,7 +48,6 @@ import emu.grasscutter.game.quest.enums.QuestCond; import emu.grasscutter.game.world.GroupReplacementData; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.*; - import java.lang.reflect.Field; import java.util.*; import javax.annotation.Nullable; @@ -281,7 +280,7 @@ public final class GameData { @Getter private static final Int2ObjectMap homeWorldAnimalDataMap = - new Int2ObjectOpenHashMap<>(); + new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap homeWorldBgmDataMap = diff --git a/src/main/java/emu/grasscutter/game/entity/EntityHomeAnimal.java b/src/main/java/emu/grasscutter/game/entity/EntityHomeAnimal.java index 65807e290..426849aa9 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityHomeAnimal.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityHomeAnimal.java @@ -13,10 +13,8 @@ import lombok.Getter; public class EntityHomeAnimal extends EntityMonster implements Rebornable { private int rebornCDTickCount; private final Position rebornPos; - @Getter - private final int rebirth; - @Getter - private final int rebirthCD; + @Getter private final int rebirth; + @Getter private final int rebirthCD; private boolean disappeared; public EntityHomeAnimal(Scene scene, HomeWorldAnimalData data, Position pos) { @@ -28,8 +26,7 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable { } @Override - public void damage(float amount, int killerId, ElementType attackType) { - } + public void damage(float amount, int killerId, ElementType attackType) {} @Override public void onTick(int sceneTime) { @@ -44,8 +41,7 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable { } @Override - public void onCreate() { - } + public void onCreate() {} @Override public Position getRebornPos() { @@ -59,7 +55,10 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable { @Override public void onAiKillSelf() { - this.getScene().broadcastPacket(new PacketSceneEntityDisappearNotify(this, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE)); + this.getScene() + .broadcastPacket( + new PacketSceneEntityDisappearNotify( + this, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE)); this.rebornCDTickCount = this.getRebornCD(); this.disappeared = true; } diff --git a/src/main/java/emu/grasscutter/game/home/HomeScene.java b/src/main/java/emu/grasscutter/game/home/HomeScene.java index 1325c23dd..b07f798b0 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeScene.java +++ b/src/main/java/emu/grasscutter/game/home/HomeScene.java @@ -31,12 +31,13 @@ public class HomeScene extends Scene { } @Override - public void setPaused(boolean paused) { - } + public void setPaused(boolean paused) {} @Override public void onTick() { - this.getEntities().values().forEach(gameEntity -> gameEntity.onTick(this.getSceneTimeSeconds())); + this.getEntities() + .values() + .forEach(gameEntity -> gameEntity.onTick(this.getSceneTimeSeconds())); this.finishLoading(); this.checkPlayerRespawn(); @@ -44,18 +45,14 @@ public class HomeScene extends Scene { } @Override - public void checkNpcGroup() { - } + public void checkNpcGroup() {} @Override - public void checkSpawns() { - } + public void checkSpawns() {} @Override - public void addItemEntity(int itemId, int amount, GameEntity bornForm) { - } + public void addItemEntity(int itemId, int amount, GameEntity bornForm) {} @Override - public void loadNpcForPlayerEnter(Player player) { - } + public void loadNpcForPlayerEnter(Player player) {} } diff --git a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java index 18d7e2bb7..c2984a0cf 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java @@ -9,7 +9,6 @@ import emu.grasscutter.game.entity.EntityHomeAnimal; import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo; - import java.util.Collection; import java.util.List; import java.util.Map; @@ -80,15 +79,19 @@ public class HomeSceneItem { public List getAnimals(Scene scene) { return this.blockItems.values().stream() - .map(HomeBlockItem::getDeployAnimalList) - .flatMap(Collection::stream) - .filter(homeAnimalItem -> GameData.getHomeWorldAnimalDataMap().containsKey(homeAnimalItem.getFurnitureId())) - .map(homeAnimalItem -> { - return new EntityHomeAnimal(scene, - GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()), - homeAnimalItem.getSpawnPos()); - }) - .toList(); + .map(HomeBlockItem::getDeployAnimalList) + .flatMap(Collection::stream) + .filter( + homeAnimalItem -> + GameData.getHomeWorldAnimalDataMap().containsKey(homeAnimalItem.getFurnitureId())) + .map( + homeAnimalItem -> { + return new EntityHomeAnimal( + scene, + GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()), + homeAnimalItem.getSpawnPos()); + }) + .toList(); } public int calComfort() { diff --git a/src/main/java/emu/grasscutter/game/home/HomeWorld.java b/src/main/java/emu/grasscutter/game/home/HomeWorld.java index 85280564d..f2ea9d3b6 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeWorld.java +++ b/src/main/java/emu/grasscutter/game/home/HomeWorld.java @@ -8,7 +8,6 @@ import emu.grasscutter.game.world.World; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.proto.ChatInfoOuterClass; import emu.grasscutter.server.game.GameServer; - import emu.grasscutter.server.packet.send.*; import java.util.List; import lombok.Getter; diff --git a/src/main/java/emu/grasscutter/game/world/Scene.java b/src/main/java/emu/grasscutter/game/world/Scene.java index 17f4212f1..eb0bd86ce 100644 --- a/src/main/java/emu/grasscutter/game/world/Scene.java +++ b/src/main/java/emu/grasscutter/game/world/Scene.java @@ -41,7 +41,6 @@ import emu.grasscutter.server.packet.send.*; import emu.grasscutter.server.scheduler.ServerTaskScheduler; import emu.grasscutter.utils.objects.KahnsSort; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; - import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; @@ -465,9 +464,11 @@ public class Scene { GameEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity(); List entities = this.getEntities().values().stream() - .filter(entity -> entity != currentEntity) - .filter(gameEntity -> !(gameEntity instanceof Rebornable rebornable) || !rebornable.isInCD()) - .toList(); + .filter(entity -> entity != currentEntity) + .filter( + gameEntity -> + !(gameEntity instanceof Rebornable rebornable) || !rebornable.isInCD()) + .toList(); player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_TYPE_MEET)); } diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index b2ebf1947..4baf00b51 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -42,7 +42,6 @@ import emu.grasscutter.server.event.types.ServerEvent; import emu.grasscutter.server.scheduler.ServerTaskScheduler; import emu.grasscutter.task.TaskMap; import emu.grasscutter.utils.Utils; - import it.unimi.dsi.fastutil.ints.*; import java.net.*; import java.time.*; diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerEntityAiKillSelfNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerEntityAiKillSelfNotify.java index a083229b3..098bfee42 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerEntityAiKillSelfNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerEntityAiKillSelfNotify.java @@ -11,7 +11,8 @@ import emu.grasscutter.server.game.GameSession; public class HandlerEntityAiKillSelfNotify extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - var entityId = EntityAiKillSelfNotifyOuterClass.EntityAiKillSelfNotify.parseFrom(payload).getEntityId(); + var entityId = + EntityAiKillSelfNotifyOuterClass.EntityAiKillSelfNotify.parseFrom(payload).getEntityId(); if (session.getPlayer().getScene().getEntityById(entityId) instanceof Rebornable rebornable) { rebornable.onAiKillSelf(); } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeEditModeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeEditModeReq.java index 0bdb51fbc..4d6ae5dfa 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeEditModeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeChangeEditModeReq.java @@ -32,7 +32,13 @@ public class HandlerHomeChangeEditModeReq extends PacketHandler { if (!req.getIsEnterEditMode()) { var scene = session.getPlayer().getScene(); - scene.addEntities(session.getPlayer().getCurHomeWorld().getHome().getHomeSceneItem(scene.getId()).getAnimals(scene)); + scene.addEntities( + session + .getPlayer() + .getCurHomeWorld() + .getHome() + .getHomeSceneItem(scene.getId()) + .getAnimals(scene)); } session.send(new PacketHomeChangeEditModeRsp(req.getIsEnterEditMode())); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeEnterEditModeFinishReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeEnterEditModeFinishReq.java index 214eabdb6..7890726e0 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeEnterEditModeFinishReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeEnterEditModeFinishReq.java @@ -18,7 +18,11 @@ public class HandlerHomeEnterEditModeFinishReq extends PacketHandler { */ var scene = session.getPlayer().getScene(); - scene.removeEntities(scene.getEntities().values().stream().filter(gameEntity -> gameEntity instanceof EntityHomeAnimal).toList(), VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE); + scene.removeEntities( + scene.getEntities().values().stream() + .filter(gameEntity -> gameEntity instanceof EntityHomeAnimal) + .toList(), + VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE); session.send(new PacketHomeEnterEditModeFinishRsp()); }