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; ...@@ -9,26 +9,26 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; 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 final class NoStaminaCommand implements CommandHandler {
public static boolean StaminaState = false;
//Temp Value
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
boolean stamina = !targetPlayer.getStamina();
if (args.size() == 1) { if (args.size() == 1) {
switch (args.get(0).toLowerCase()) { switch (args.get(0).toLowerCase()) {
case "on": case "on":
StaminaState = true; stamina = true;
break; break;
case "off": case "off":
StaminaState = false; stamina = false;
break; break;
default: default:
//toggled
break; 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