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
21a15032
Commit
21a15032
authored
Apr 19, 2022
by
SpikeHD
Browse files
Give character command base
parent
2d43ae81
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/commands/PlayerCommands.java
View file @
21a15032
...
...
@@ -177,6 +177,35 @@ public final class PlayerCommands {
}
}
@Command
(
label
=
"givechar"
,
aliases
=
{
"givec"
},
usage
=
"Usage: givechar [avatar id] [level]"
)
public
static
class
GiveCharCommand
implements
CommandHandler
{
@Override
public
void
execute
(
GenshinPlayer
player
,
List
<
String
>
args
)
{
int
avatarID
=
Integer
.
parseInt
(
args
.
get
(
0
));
int
level
=
Integer
.
parseInt
(
args
.
get
(
1
));
if
(
player
==
null
)
{
CommandHandler
.
sendMessage
(
null
,
"Player not found."
);
return
;
}
AvatarData
avatarData
=
GenshinData
.
getAvatarDataMap
().
get
(
avatarID
);
if
(
avatarData
==
null
)
{
CommandHandler
.
sendMessage
(
null
,
"Invalid avatar id."
);
return
;
}
if
(
args
.
size
()
==
0
)
{
CommandHandler
.
sendMessage
(
player
,
"Usage: givechar [avatar id] [level]"
);
return
;
}
GenshinAvatar
avatar
=
new
GenshinAvatar
(
avatarID
);
avatar
.
setLevel
(
level
);
player
.
addAvatar
(
avatar
);
}
}
@Command
(
label
=
"spawn"
,
execution
=
Command
.
Execution
.
PLAYER
,
usage
=
"Usage: spawn <entityId|entityName> [level] [amount]"
)
public
static
class
SpawnCommand
implements
CommandHandler
{
...
...
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