NoStaminaCommand.java 1.28 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;


@Command(label = "nostamina", usage = "nostamina [on|off]", permission = "player.nostamina", permissionTargeted = "player.nostamina.others", description = "commands.nostamina.description")
public final class NoStaminaCommand implements CommandHandler {
    public static boolean StaminaState = false;
    //Temp Value
    @Override
    public void execute(Player sender, Player targetPlayer, List<String> args) {
        if (args.size() == 1) {
            switch (args.get(0).toLowerCase()) {
                case "on":
                    StaminaState = true;
                    break;
                case "off":
                    StaminaState = false;
                    break;
                default:
                    break;
            }
        }
        targetPlayer.setStamina(StaminaState);//Set

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