mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 05:12:57 +08:00
Merge pull request #92 from Grasscutters/account-fix
Fixes for the error in the revive command
This commit is contained in:
commit
8b5d78557f
@ -86,8 +86,10 @@ public final class Grasscutter {
|
|||||||
public static void loadConfig() {
|
public static void loadConfig() {
|
||||||
try (FileReader file = new FileReader(configFile)) {
|
try (FileReader file = new FileReader(configFile)) {
|
||||||
config = gson.fromJson(file, Config.class);
|
config = gson.fromJson(file, Config.class);
|
||||||
|
saveConfig();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Grasscutter.config = new Config(); saveConfig();
|
Grasscutter.config = new Config();
|
||||||
|
saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
package emu.grasscutter.command.commands;
|
package emu.grasscutter.command.commands;
|
||||||
|
|
||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.game.GenshinPlayer;
|
import emu.grasscutter.game.GenshinPlayer;
|
||||||
import emu.grasscutter.game.TeamManager;
|
import emu.grasscutter.game.TeamManager;
|
||||||
//import emu.grasscutter.game.avatar.GenshinAvatar;
|
//import emu.grasscutter.game.avatar.GenshinAvatar;
|
||||||
//import emu.grasscutter.game.TeamInfo;
|
//import emu.grasscutter.game.TeamInfo;
|
||||||
import emu.grasscutter.game.entity.EntityAvatar;
|
import emu.grasscutter.game.entity.EntityAvatar;
|
||||||
import emu.grasscutter.game.props.FightProperty;
|
import emu.grasscutter.game.props.FightProperty;
|
||||||
import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify;
|
import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify;
|
||||||
import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify;
|
import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Command(label = "revive", aliases = {"rev"},
|
@Command(label = "revive", aliases = {"rev"},
|
||||||
usage = "revive|rev", description = "Revive character(s) that died)")
|
usage = "revive|rev", description = "Revive character(s) that died)")
|
||||||
public class Revive implements CommandHandler {
|
public class ReviveCommand implements CommandHandler {
|
||||||
//private Object teamId;
|
//private Object teamId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(GenshinPlayer player, List<String> args) {
|
public void execute(GenshinPlayer player, List<String> args) {
|
||||||
for (EntityAvatar entity2 : TeamManager.getActiveTeam()) {
|
for (EntityAvatar entity2 : player.getTeamManager().getActiveTeam()) {
|
||||||
entity2.setFightProperty(
|
entity2.setFightProperty(
|
||||||
FightProperty.FIGHT_PROP_CUR_HP,
|
FightProperty.FIGHT_PROP_CUR_HP,
|
||||||
entity2.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * .4f
|
entity2.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * .4f
|
||||||
);
|
);
|
||||||
player.sendPacket(new PacketAvatarFightPropUpdateNotify(entity2.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP));
|
player.sendPacket(new PacketAvatarFightPropUpdateNotify(entity2.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP));
|
||||||
player.sendPacket(new PacketAvatarLifeStateChangeNotify(entity2.getAvatar()));
|
player.sendPacket(new PacketAvatarLifeStateChangeNotify(entity2.getAvatar()));
|
||||||
}
|
}
|
||||||
player.dropMessage("Character revived.");
|
player.dropMessage("Character revived.");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user