RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
PlayerSerializer.java
1package com.osroyale.game.world.entity.mob.player.persist;
2
3import com.osroyale.Config;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.net.codec.login.LoginResponse;
6
30
31public final class PlayerSerializer {
32
33 private static final PlayerPersistable perstable = Config.FORUM_INTEGRATION
34 ? new PlayerPersistDB()
35 : new PlayerPersistFile();
36
37 public static void save(Player player) {
38 if (player.isBot) {
39 return;
40 }
41
42 // player save thread
43 Thread.startVirtualThread(() -> {
44 try {
45 perstable.save(player);
46 } catch (final Exception e) {
47 e.printStackTrace();
48 }
49 });
50 }
51
52 public static LoginResponse load(Player player, String expectedPassword) {
53 if (player.isBot) {
54 return LoginResponse.COULD_NOT_COMPLETE_LOGIN;
55 }
56
57 return perstable.load(player, expectedPassword);
58 }
59}
static final boolean FORUM_INTEGRATION
Definition Config.java:158