Commit 71b53e0b authored by tamilpp25's avatar tamilpp25 Committed by GitHub
Browse files

Adding toggle feature to "nostamina" command similar to "godmode" command (#1152)

* stamina command enhancement

* added "ns" as command aliases for NoStaminaCommand
parent e1688c86
......@@ -9,26 +9,26 @@ 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")
@Command(label = "nostamina", usage = "nostamina [on|off|toggle]",aliases = {"ns"},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) {
boolean stamina = !targetPlayer.getStamina();
if (args.size() == 1) {
switch (args.get(0).toLowerCase()) {
case "on":
StaminaState = true;
stamina = true;
break;
case "off":
StaminaState = false;
stamina = false;
break;
default:
//toggled
break;
}
}
targetPlayer.setStamina(StaminaState);//Set
targetPlayer.setStamina(stamina);//Set
CommandHandler.sendMessage(sender, translate(sender, "commands.nostamina.success", (StaminaState ? translate(sender, "commands.status.enabled") : translate(sender, "commands.status.disabled")), targetPlayer.getNickname()));
CommandHandler.sendMessage(sender, translate(sender, "commands.nostamina.success", (stamina ? translate(sender, "commands.status.enabled") : translate(sender, "commands.status.disabled")), targetPlayer.getNickname()));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment