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
2d2013df
Commit
2d2013df
authored
Apr 19, 2022
by
Melledy
Committed by
GitHub
Apr 19, 2022
Browse files
Merge pull request #22 from SpikeHD/level_setting_commands
Set world level command
parents
0a864789
c5cebf27
Changes
2
Show whitespace changes
Inline
Side-by-side
README.md
View file @
2d2013df
...
@@ -56,6 +56,8 @@ There is a dummy user named "Server" in every player's friends list that you can
...
@@ -56,6 +56,8 @@ There is a dummy user named "Server" in every player's friends list that you can
`!killall`
`!killall`
`!setworldlevel [level]`
- Relog to see effects properly
`!godmode`
- Prevents you from taking damage
`!godmode`
- Prevents you from taking damage
`!resetconst`
- Resets the constellation level on your current active character, will need to relog after using the command to see any changes.
`!resetconst`
- Resets the constellation level on your current active character, will need to relog after using the command to see any changes.
...
...
src/main/java/emu/grasscutter/commands/PlayerCommands.java
View file @
2d2013df
...
@@ -17,6 +17,7 @@ import emu.grasscutter.game.inventory.Inventory;
...
@@ -17,6 +17,7 @@ import emu.grasscutter.game.inventory.Inventory;
import
emu.grasscutter.game.inventory.ItemType
;
import
emu.grasscutter.game.inventory.ItemType
;
import
emu.grasscutter.game.props.ActionReason
;
import
emu.grasscutter.game.props.ActionReason
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.PlayerProperty
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketItemAddHintNotify
;
import
emu.grasscutter.server.packet.send.PacketItemAddHintNotify
;
import
emu.grasscutter.utils.Position
;
import
emu.grasscutter.utils.Position
;
...
@@ -432,6 +433,29 @@ public final class PlayerCommands {
...
@@ -432,6 +433,29 @@ public final class PlayerCommands {
}
}
}
}
@Command
(
label
=
"setworldlevel"
,
aliases
=
{
"setworldlvl"
},
usage
=
"Usage: setworldlevel <level>"
,
execution
=
Command
.
Execution
.
PLAYER
)
public
static
class
SetWorldLevelCommand
implements
CommandHandler
{
@Override
public
void
execute
(
GenshinPlayer
player
,
List
<
String
>
args
)
{
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
sendMessage
(
null
,
"Usage: setworldlevel <level>"
);
return
;
}
try
{
int
level
=
Integer
.
parseInt
(
args
.
get
(
0
));
// Set in both world and player props
player
.
getWorld
().
setWorldLevel
(
level
);
player
.
setProperty
(
PlayerProperty
.
PROP_PLAYER_WORLD_LEVEL
,
level
);
player
.
dropMessage
(
"World level set to "
+
level
+
"."
);
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
sendMessage
(
null
,
"Invalid world level."
);
}
}
}
@Command
(
label
=
"clearartifacts"
,
aliases
=
{
"clearart"
},
@Command
(
label
=
"clearartifacts"
,
aliases
=
{
"clearart"
},
usage
=
"Usage: clearartifacts"
,
execution
=
Command
.
Execution
.
PLAYER
)
usage
=
"Usage: clearartifacts"
,
execution
=
Command
.
Execution
.
PLAYER
)
public
static
class
ClearArtifactsCommand
implements
CommandHandler
{
public
static
class
ClearArtifactsCommand
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