From 04791b68be5f8956b4d676547f8456739e376423 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Thu, 21 Apr 2022 14:47:04 -0700 Subject: [PATCH] Refactor Revive Command + fix syntax error No idea how I missed the syntax error while reviewing --- .../{Revive.java => ReviveCommand.java} | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) rename src/main/java/emu/grasscutter/command/commands/{Revive.java => ReviveCommand.java} (88%) diff --git a/src/main/java/emu/grasscutter/command/commands/Revive.java b/src/main/java/emu/grasscutter/command/commands/ReviveCommand.java similarity index 88% rename from src/main/java/emu/grasscutter/command/commands/Revive.java rename to src/main/java/emu/grasscutter/command/commands/ReviveCommand.java index 3f830f3e2..554af4a50 100644 --- a/src/main/java/emu/grasscutter/command/commands/Revive.java +++ b/src/main/java/emu/grasscutter/command/commands/ReviveCommand.java @@ -1,33 +1,33 @@ -package emu.grasscutter.command.commands; - -import emu.grasscutter.command.Command; -import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; -import emu.grasscutter.game.TeamManager; -//import emu.grasscutter.game.avatar.GenshinAvatar; -//import emu.grasscutter.game.TeamInfo; -import emu.grasscutter.game.entity.EntityAvatar; -import emu.grasscutter.game.props.FightProperty; -import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; -import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; - -import java.util.List; - -@Command(label = "revive", aliases = {"rev"}, - usage = "revive|rev", description = "Revive character(s) that died)") -public class Revive implements CommandHandler { - //private Object teamId; - - @Override - public void execute(GenshinPlayer player, List args) { - for (EntityAvatar entity2 : TeamManager.getActiveTeam()) { - entity2.setFightProperty( - FightProperty.FIGHT_PROP_CUR_HP, - entity2.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * .4f - ); - player.sendPacket(new PacketAvatarFightPropUpdateNotify(entity2.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP)); - player.sendPacket(new PacketAvatarLifeStateChangeNotify(entity2.getAvatar())); - } - player.dropMessage("Character revived."); - } -} +package emu.grasscutter.command.commands; + +import emu.grasscutter.command.Command; +import emu.grasscutter.command.CommandHandler; +import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.TeamManager; +//import emu.grasscutter.game.avatar.GenshinAvatar; +//import emu.grasscutter.game.TeamInfo; +import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; +import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; + +import java.util.List; + +@Command(label = "revive", aliases = {"rev"}, + usage = "revive|rev", description = "Revive character(s) that died)") +public class ReviveCommand implements CommandHandler { + //private Object teamId; + + @Override + public void execute(GenshinPlayer player, List args) { + for (EntityAvatar entity2 : player.getTeamManager().getActiveTeam()) { + entity2.setFightProperty( + FightProperty.FIGHT_PROP_CUR_HP, + entity2.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * .4f + ); + player.sendPacket(new PacketAvatarFightPropUpdateNotify(entity2.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP)); + player.sendPacket(new PacketAvatarLifeStateChangeNotify(entity2.getAvatar())); + } + player.dropMessage("Character revived."); + } +}