mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 13:11:09 +00:00
set world level command
This commit is contained in:
parent
2d43ae8166
commit
d5ad82b598
@ -15,6 +15,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;
|
||||||
@ -303,6 +304,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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user