修复服务器数据写入

This commit is contained in:
Gitea 2022-12-13 14:49:02 +08:00
parent 3ecbb1be3a
commit fc2856e69b
9 changed files with 7 additions and 23 deletions

View File

@ -277,11 +277,11 @@ public class ConfigContainer {
public static class ConsoleAccount { public static class ConsoleAccount {
public int avatarId = 10000007; public int avatarId = 10000007;
public int nameCardId = 210001; public int nameCardId = 210001;
public int adventureRank = 1; public int adventureRank = 60;
public int worldLevel = 0; public int worldLevel = 8;
public String nickName = "Server"; public String nickName = "Server";
public String signature = "Welcome to Grasscutter!"; public String signature = "Server Running in "+System.getProperty("os.name");
} }
public static class Files { public static class Files {

View File

@ -2,7 +2,6 @@ package emu.grasscutter.game.gacha;
import static emu.grasscutter.config.Configuration.*; import static emu.grasscutter.config.Configuration.*;
import java.io.File;
import java.nio.file.*; import java.nio.file.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -29,7 +28,6 @@ import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam;
import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode; import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode;
import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.BaseGameSystem;
import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.game.GameServerTickEvent;
import emu.grasscutter.server.packet.send.PacketDoGachaRsp; import emu.grasscutter.server.packet.send.PacketDoGachaRsp;
import emu.grasscutter.utils.FileUtils; import emu.grasscutter.utils.FileUtils;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
@ -388,7 +386,7 @@ public class GachaSystem extends BaseGameSystem {
} }
@Subscribe @Subscribe
public synchronized void watchBannerJson(GameServerTickEvent tickEvent) { public synchronized void watchBannerJson() {
if (GAME_OPTIONS.watchGachaConfig) { if (GAME_OPTIONS.watchGachaConfig) {
try { try {
WatchKey watchKey = watchService.take(); WatchKey watchKey = watchService.take();

View File

@ -1253,7 +1253,6 @@ public class Player {
this.save(); this.save();
this.getTeamManager().saveAvatars(); this.getTeamManager().saveAvatars();
this.getFriendsList().save(); this.getFriendsList().save();
}catch (Throwable e) { }catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
Grasscutter.getLogger().warn("Player (UID {}) save failure", getUid()); Grasscutter.getLogger().warn("Player (UID {}) save failure", getUid());

View File

@ -1,5 +0,0 @@
package emu.grasscutter.server.game;
public class GameServerStartFinishEvent {
// Placeholder class for now, probably will get used later
}

View File

@ -1,5 +0,0 @@
package emu.grasscutter.server.game;
public class GameServerStopEvent {
// Placeholder class for now, probably will get used later
}

View File

@ -1,5 +0,0 @@
package emu.grasscutter.server.game;
public class GameServerTickEvent {
// Placeholder class for now, probably will get used later
}

View File

@ -139,6 +139,7 @@ public class GameSession implements GameSessionManager.KcpChannel {
default -> { default -> {
} }
} }
tunnel.writeData(packet.build());
} }
@Override @Override

View File

@ -69,6 +69,7 @@ public class HandlerGetPlayerTokenReq extends PacketHandler {
Player player = DatabaseHelper.getPlayerByAccount(account, Player.class); Player player = DatabaseHelper.getPlayerByAccount(account, Player.class);
if (player == null) { if (player == null) {
Grasscutter.getLogger().info("P: "+player.getNickname());
int nextPlayerUid = DatabaseHelper.getNextPlayerId(session.getAccount().getReservedPlayerUid()); int nextPlayerUid = DatabaseHelper.getNextPlayerId(session.getAccount().getReservedPlayerUid());
// Create player instance from event. // Create player instance from event.

View File

@ -26,7 +26,7 @@ public class PacketGetPlayerFriendListRsp extends BasePacket {
.setProfilePicture(ProfilePicture.newBuilder().setAvatarId(serverAccount.avatarId)) .setProfilePicture(ProfilePicture.newBuilder().setAvatarId(serverAccount.avatarId))
.setWorldLevel(serverAccount.worldLevel) .setWorldLevel(serverAccount.worldLevel)
.setSignature(serverAccount.signature) .setSignature(serverAccount.signature)
.setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) .setLastActiveTime(0)
.setNameCardId(serverAccount.nameCardId) .setNameCardId(serverAccount.nameCardId)
.setOnlineState(FriendOnlineState.FRIEND_ONLINE_STATE_ONLINE) .setOnlineState(FriendOnlineState.FRIEND_ONLINE_STATE_ONLINE)
.setParam(1) .setParam(1)