mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 04:03:22 +08:00
Add a new command "nostamina" (#877)
* Add a new command " nostamina\ * Fix * Fix 2 * Renamed some names. * Update zh-CN.json Fix an existing language expression error.
This commit is contained in:
parent
5c3d99800e
commit
5b3c05a9a0
@ -0,0 +1,40 @@
|
||||
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 (targetPlayer == null) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.execution.need_target"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package emu.grasscutter.game.managers.StaminaManager;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.command.commands.NoStaminaCommand;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.game.entity.EntityAvatar;
|
||||
import emu.grasscutter.game.entity.GameEntity;
|
||||
@ -297,9 +298,11 @@ public class StaminaManager {
|
||||
|
||||
// Returns new stamina and sends PlayerPropNotify or VehicleStaminaNotify
|
||||
public int setStamina(GameSession session, String reason, int newStamina, boolean isCharacterStamina) {
|
||||
if (!GAME_OPTIONS.staminaUsage) {
|
||||
// Target Player
|
||||
if (!GAME_OPTIONS.staminaUsage || session.getPlayer().getStamina()) {
|
||||
newStamina = getMaxCharacterStamina();
|
||||
}
|
||||
|
||||
// set stamina if is character stamina
|
||||
if (isCharacterStamina) {
|
||||
player.setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
|
||||
|
@ -121,6 +121,7 @@ public class Player {
|
||||
private int mainCharacterId;
|
||||
private boolean godmode;
|
||||
|
||||
private boolean stamina;
|
||||
private boolean moonCard;
|
||||
private Date moonCardStartTime;
|
||||
private int moonCardDuration;
|
||||
@ -781,7 +782,14 @@ public class Player {
|
||||
}
|
||||
this.save();
|
||||
}
|
||||
|
||||
public boolean getStamina() {
|
||||
// Get Stamina
|
||||
return stamina;
|
||||
}
|
||||
public void setStamina(boolean stamina) {
|
||||
// Set Stamina
|
||||
this.stamina = stamina;
|
||||
}
|
||||
public boolean inGodmode() {
|
||||
return godmode;
|
||||
}
|
||||
|
@ -173,6 +173,10 @@
|
||||
"success": "Godmode is now %s for %s.",
|
||||
"description": "Prevents you from taking damage. Defaults to toggle."
|
||||
},
|
||||
"nostamina": {
|
||||
"success": "NoStamina is now %s for %s.",
|
||||
"description": "Keep your endurance to the maximum."
|
||||
},
|
||||
"heal": {
|
||||
"success": "All characters have been healed.",
|
||||
"description": "Heal all characters in your current team."
|
||||
|
@ -145,6 +145,10 @@
|
||||
"invalid_amount_or_playerId": "无效的数量/玩家ID。",
|
||||
"description": "给予所有物品"
|
||||
},
|
||||
"nostamina": {
|
||||
"success": "NoStamina %s 对于 %s.",
|
||||
"description": "保持你的体力处于最高状态。"
|
||||
},
|
||||
"giveArtifact": {
|
||||
"usage": "用法:giveart|gart [玩家] <圣遗物ID> <主词条ID> [<副词条ID>[,<强化次数>]]... [等级]",
|
||||
"id_error": "无效的圣遗物ID。",
|
||||
|
Loading…
Reference in New Issue
Block a user