From cdb0dc560ad481ddddfc37691bed72ded62d23f2 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 17 Nov 2023 04:58:02 +0000 Subject: [PATCH] Format code [skip actions] --- .../data/binout/AbilityModifier.java | 1 - .../config/fields/ConfigCombatSummon.java | 3 +-- .../game/ability/actions/ActionSummon.java | 16 +++++++++---- .../game/entity/EntityMonster.java | 23 +++++++++---------- .../grasscutter/game/entity/GameEntity.java | 10 ++++---- .../send/PacketMonsterSummonTagNotify.java | 7 +----- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java index 80c951e0d..562616bb4 100644 --- a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java +++ b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java @@ -332,7 +332,6 @@ public class AbilityModifier implements Serializable { public int monsterID; public int summonTag; - public AbilityModifierAction[] actions; public AbilityModifierAction[] successActions; public AbilityModifierAction[] failActions; diff --git a/src/main/java/emu/grasscutter/data/binout/config/fields/ConfigCombatSummon.java b/src/main/java/emu/grasscutter/data/binout/config/fields/ConfigCombatSummon.java index c8c373d12..6543c6760 100644 --- a/src/main/java/emu/grasscutter/data/binout/config/fields/ConfigCombatSummon.java +++ b/src/main/java/emu/grasscutter/data/binout/config/fields/ConfigCombatSummon.java @@ -1,8 +1,7 @@ package emu.grasscutter.data.binout.config.fields; -import lombok.*; -import lombok.experimental.FieldDefaults; import java.util.List; +import lombok.*; @Data public class ConfigCombatSummon { diff --git a/src/main/java/emu/grasscutter/game/ability/actions/ActionSummon.java b/src/main/java/emu/grasscutter/game/ability/actions/ActionSummon.java index 8ebe0687f..02a3e0194 100644 --- a/src/main/java/emu/grasscutter/game/ability/actions/ActionSummon.java +++ b/src/main/java/emu/grasscutter/game/ability/actions/ActionSummon.java @@ -8,8 +8,8 @@ import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import emu.grasscutter.game.ability.Ability; import emu.grasscutter.game.entity.*; import emu.grasscutter.game.world.*; -import emu.grasscutter.server.packet.send.PacketMonsterSummonTagNotify; import emu.grasscutter.net.proto.EPKDEHOJFLIOuterClass.EPKDEHOJFLI; +import emu.grasscutter.server.packet.send.PacketMonsterSummonTagNotify; import emu.grasscutter.utils.*; @AbilityAction(AbilityModifierAction.Type.Summon) @@ -26,7 +26,8 @@ public class ActionSummon extends AbilityActionHandler { // 13: Vector rot summonPosRot = EPKDEHOJFLI.parseFrom(abilityData); } catch (InvalidProtocolBufferException e) { - Grasscutter.getLogger().error("Failed to parse abilityData: {}", Utils.bytesToHex(abilityData.toByteArray())); + Grasscutter.getLogger() + .error("Failed to parse abilityData: {}", Utils.bytesToHex(abilityData.toByteArray())); return false; } @@ -51,8 +52,15 @@ public class ActionSummon extends AbilityActionHandler { scene.addEntity(entity); scene.getPlayers().get(0).sendPacket(new PacketMonsterSummonTagNotify(ownerEntity)); - Grasscutter.getLogger().trace("Spawned entityId {} monsterId {} pos {} rot {}, target { {} }, action { {} }", - entity.getId(), monsterId, pos, rot, target, action); + Grasscutter.getLogger() + .trace( + "Spawned entityId {} monsterId {} pos {} rot {}, target { {} }, action { {} }", + entity.getId(), + monsterId, + pos, + rot, + target, + action); return true; } else { diff --git a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java index f8db2acc8..237c27b57 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java @@ -83,12 +83,15 @@ public class EntityMonster extends GameEntity { this.configEntityMonster = null; } - if (this.configEntityMonster != null && - this.configEntityMonster.getCombat() != null && - this.configEntityMonster.getCombat().getSummon() != null && - this.configEntityMonster.getCombat().getSummon().getSummonTags() != null) { - this.configEntityMonster.getCombat().getSummon().getSummonTags().forEach( - t -> this.summonTagMap.put(t.getSummonTag(), null)); + if (this.configEntityMonster != null + && this.configEntityMonster.getCombat() != null + && this.configEntityMonster.getCombat().getSummon() != null + && this.configEntityMonster.getCombat().getSummon().getSummonTags() != null) { + this.configEntityMonster + .getCombat() + .getSummon() + .getSummonTags() + .forEach(t -> this.summonTagMap.put(t.getSummonTag(), null)); } // Monster weapon @@ -408,13 +411,9 @@ public class EntityMonster extends GameEntity { var data = this.getMonsterData(); var aiInfo = - SceneEntityAiInfo.newBuilder() - .setIsAiOpen(true) - .setBornPos(this.getBornPos().toProto()); + SceneEntityAiInfo.newBuilder().setIsAiOpen(true).setBornPos(this.getBornPos().toProto()); if (ownerEntityId != 0) { - aiInfo.setServantInfo( - ServantInfo.newBuilder() - .setMasterEntityId(ownerEntityId)); + aiInfo.setServantInfo(ServantInfo.newBuilder().setMasterEntityId(ownerEntityId)); } var authority = diff --git a/src/main/java/emu/grasscutter/game/entity/GameEntity.java b/src/main/java/emu/grasscutter/game/entity/GameEntity.java index 6d7d6e6e5..7e78dbb10 100644 --- a/src/main/java/emu/grasscutter/game/entity/GameEntity.java +++ b/src/main/java/emu/grasscutter/game/entity/GameEntity.java @@ -1,6 +1,5 @@ package emu.grasscutter.game.entity; -import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; import emu.grasscutter.data.binout.*; import emu.grasscutter.game.ability.*; @@ -122,8 +121,9 @@ public abstract class GameEntity { public void onAddAbilityModifier(AbilityModifier data) { // Set limbo state (invulnerability at a certain HP threshold) // if ability modifier calls for it - if (data.state == AbilityModifier.State.Limbo && - data.properties != null && data.properties.Actor_HpThresholdRatio > .0f) { + if (data.state == AbilityModifier.State.Limbo + && data.properties != null + && data.properties.Actor_HpThresholdRatio > .0f) { this.setLimbo(data.properties.Actor_HpThresholdRatio); } } @@ -198,8 +198,8 @@ public abstract class GameEntity { // Don't let entity die while in limbo. effectiveDamage = curHp - 1; } - } - else if (curHp != Float.POSITIVE_INFINITY && !lockHP || lockHP && curHp <= event.getDamage()) { + } else if (curHp != Float.POSITIVE_INFINITY && !lockHP + || lockHP && curHp <= event.getDamage()) { effectiveDamage = event.getDamage(); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketMonsterSummonTagNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketMonsterSummonTagNotify.java index dab91e2d9..fb0ffe46f 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketMonsterSummonTagNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketMonsterSummonTagNotify.java @@ -1,21 +1,16 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.entity.EntityMonster; -import emu.grasscutter.game.player.Player; -import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.packet.*; import emu.grasscutter.net.proto.MonsterSummonTagNotifyOuterClass.MonsterSummonTagNotify; import java.util.*; -import static java.util.Map.entry; public class PacketMonsterSummonTagNotify extends BasePacket { public PacketMonsterSummonTagNotify(EntityMonster monsterEntity) { super(PacketOpcodes.MonsterSummonTagNotify); - var proto = - MonsterSummonTagNotify.newBuilder() - .setMonsterEntityId(monsterEntity.getId()); + var proto = MonsterSummonTagNotify.newBuilder().setMonsterEntityId(monsterEntity.getId()); monsterEntity.getSummonTagMap().forEach((k, v) -> proto.putSummonTagMap(k, v == null ? 0 : 1)); this.setData(proto.build());