Direct almost all chr saving through CharacterSaver

Client#disconnectInternal remains.
Had to remove some configurable save points to keep it simple.
This commit is contained in:
P0nk
2023-08-04 16:05:10 +02:00
parent e52f646558
commit 4e39142fb3
18 changed files with 122 additions and 152 deletions

View File

@@ -41,7 +41,7 @@ public class SaveAllCommand extends Command {
Character player = c.getPlayer();
for (World world : Server.getInstance().getWorlds()) {
for (Character chr : world.getPlayerStorage().getAllCharacters()) {
chr.saveCharToDB();
ctx.characterSaver().save(chr);
}
}
String message = player.getName() + " used !saveall.";

View File

@@ -55,7 +55,7 @@ public class WarpWorldCommand extends Command {
player.getMap().removePlayer(player);//LOL FORGOT THIS ><
player.setSessionTransitionState();
player.setWorld(worldb);
player.saveCharToDB();//To set the new world :O (true because else 2 player instances are created, one in both worlds)
ctx.characterSaver().save(player);//To set the new world :O (true because else 2 player instances are created, one in both worlds)
c.sendPacket(PacketCreator.getChannelChange(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1])));
} catch (UnknownHostException | NumberFormatException ex) {
ex.printStackTrace();