Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
04791b68
Commit
04791b68
authored
Apr 21, 2022
by
Melledy
Browse files
Refactor Revive Command + fix syntax error
No idea how I missed the syntax error while reviewing
parent
e884970a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/Revive.java
→
src/main/java/emu/grasscutter/command/commands/Revive
Command
.java
View file @
04791b68
package
emu.grasscutter.command.commands
;
package
emu.grasscutter.command.commands
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.TeamManager
;
import
emu.grasscutter.game.TeamManager
;
//import emu.grasscutter.game.avatar.GenshinAvatar;
//import emu.grasscutter.game.avatar.GenshinAvatar;
//import emu.grasscutter.game.TeamInfo;
//import emu.grasscutter.game.TeamInfo;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify
;
import
java.util.List
;
import
java.util.List
;
@Command
(
label
=
"revive"
,
aliases
=
{
"rev"
},
@Command
(
label
=
"revive"
,
aliases
=
{
"rev"
},
usage
=
"revive|rev"
,
description
=
"Revive character(s) that died)"
)
usage
=
"revive|rev"
,
description
=
"Revive character(s) that died)"
)
public
class
Revive
implements
CommandHandler
{
public
class
Revive
Command
implements
CommandHandler
{
//private Object teamId;
//private Object teamId;
@Override
@Override
public
void
execute
(
GenshinPlayer
player
,
List
<
String
>
args
)
{
public
void
execute
(
GenshinPlayer
player
,
List
<
String
>
args
)
{
for
(
EntityAvatar
entity2
:
TeamManager
.
getActiveTeam
())
{
for
(
EntityAvatar
entity2
:
player
.
get
TeamManager
()
.
getActiveTeam
())
{
entity2
.
setFightProperty
(
entity2
.
setFightProperty
(
FightProperty
.
FIGHT_PROP_CUR_HP
,
FightProperty
.
FIGHT_PROP_CUR_HP
,
entity2
.
getFightProperty
(
FightProperty
.
FIGHT_PROP_MAX_HP
)
*
.
4
f
entity2
.
getFightProperty
(
FightProperty
.
FIGHT_PROP_MAX_HP
)
*
.
4
f
);
);
player
.
sendPacket
(
new
PacketAvatarFightPropUpdateNotify
(
entity2
.
getAvatar
(),
FightProperty
.
FIGHT_PROP_CUR_HP
));
player
.
sendPacket
(
new
PacketAvatarFightPropUpdateNotify
(
entity2
.
getAvatar
(),
FightProperty
.
FIGHT_PROP_CUR_HP
));
player
.
sendPacket
(
new
PacketAvatarLifeStateChangeNotify
(
entity2
.
getAvatar
()));
player
.
sendPacket
(
new
PacketAvatarLifeStateChangeNotify
(
entity2
.
getAvatar
()));
}
}
player
.
dropMessage
(
"Character revived."
);
player
.
dropMessage
(
"Character revived."
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment