mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-24 00:11:31 +00:00
Add /setstats mhp
to set Max HP (#407)
* Fixed `/setstats hp` without changing the max hp. The Max HP should be modified. * Add `/setstats mhp` to set Max HP
This commit is contained in:
parent
2c0576f697
commit
29c95cb1b6
@ -28,9 +28,21 @@ public final class SetStatsCommand implements CommandHandler {
|
||||
String stat = args.get(0);
|
||||
switch (stat) {
|
||||
default:
|
||||
CommandHandler.sendMessage(sender, "Usage: /setstats|stats <hp | def | atk | em | er | crate | cdmg> <value> for basic stats");
|
||||
CommandHandler.sendMessage(sender, "Usage: /setstats|stats <hp | mhp | def | atk | em | er | crate | cdmg> <value> for basic stats");
|
||||
CommandHandler.sendMessage(sender, "Usage: /stats <epyro | ecryo | ehydro | egeo | edend | eelec | ephys> <amount> for elemental bonus");
|
||||
return;
|
||||
case "mhp":
|
||||
try {
|
||||
int health = Integer.parseInt(args.get(1));
|
||||
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
|
||||
entity.setFightProperty(FightProperty.FIGHT_PROP_MAX_HP, health);
|
||||
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_MAX_HP));
|
||||
CommandHandler.sendMessage(sender, "MAX HP set to " + health + ".");
|
||||
} catch (NumberFormatException ignored) {
|
||||
CommandHandler.sendMessage(sender, "Invalid Max HP value.");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "hp":
|
||||
try {
|
||||
int health = Integer.parseInt(args.get(1));
|
||||
|
Loading…
Reference in New Issue
Block a user