PositionCommand.java 1.07 KB
Newer Older
KingRainbow44's avatar
KingRainbow44 committed
1
2
3
4
package emu.grasscutter.command.commands;

import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
Melledy's avatar
Melledy committed
5
import emu.grasscutter.game.player.Player;
AnimeGitB's avatar
AnimeGitB committed
6
import emu.grasscutter.utils.Position;
KingRainbow44's avatar
KingRainbow44 committed
7
8
9

import java.util.List;

10
11
import static emu.grasscutter.utils.Language.translate;

12
@Command(label = "position", usage = "position", aliases = {"pos"})
KingRainbow44's avatar
KingRainbow44 committed
13
14
public final class PositionCommand implements CommandHandler {

15
16
17
18
19
    @Override
    public String description() {
        return translate("commands.position.description");
    }

KingRainbow44's avatar
KingRainbow44 committed
20
    @Override
AnimeGitB's avatar
AnimeGitB committed
21
    public void execute(Player sender, Player targetPlayer, List<String> args) {
AnimeGitB's avatar
AnimeGitB committed
22
        if (targetPlayer == null) {
23
            CommandHandler.sendMessage(sender, translate("commands.execution.need_target"));
KingRainbow44's avatar
KingRainbow44 committed
24
25
26
            return;
        }

AnimeGitB's avatar
AnimeGitB committed
27
        Position pos = targetPlayer.getPos();
28
29
30
        CommandHandler.sendMessage(sender, translate("commands.position.success",
                Float.toString(pos.getX()), Float.toString(pos.getY()), Float.toString(pos.getZ()),
                Integer.toString(targetPlayer.getSceneId())));
KingRainbow44's avatar
KingRainbow44 committed
31
32
    }
}