NoStaminaCommand.java 1.31 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
package emu.grasscutter.command.commands;

import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;

import java.util.List;

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


Magix's avatar
Magix committed
12
@Command(label = "nostamina", usage = "nostamina [on|off|toggle]", aliases = {"ns"}, permission = "player.nostamina", permissionTargeted = "player.nostamina.others", description = "commands.nostamina.description")
13
14
15
public final class NoStaminaCommand implements CommandHandler {
    @Override
    public void execute(Player sender, Player targetPlayer, List<String> args) {
16
        boolean stamina = !targetPlayer.getStamina();
17
18
19
        if (args.size() == 1) {
            switch (args.get(0).toLowerCase()) {
                case "on":
20
                    stamina = true;
21
22
                    break;
                case "off":
23
                    stamina = false;
24
25
                    break;
                default:
Magix's avatar
Magix committed
26
                    // toggled
27
28
29
                    break;
            }
        }
Magix's avatar
Magix committed
30
        targetPlayer.setStamina(stamina); //Set
31

32
        CommandHandler.sendMessage(sender, translate(sender, "commands.nostamina.success", (stamina ? translate(sender, "commands.status.enabled") : translate(sender, "commands.status.disabled")), targetPlayer.getNickname()));
33
34
    }
}