mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 05:04:20 +00:00
Adding toggle feature to "nostamina" command similar to "godmode" command (#1152)
* stamina command enhancement * added "ns" as command aliases for NoStaminaCommand
This commit is contained in:
parent
e1688c866f
commit
71b53e0be4
@ -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()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user