修复服务器数据写入

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 int avatarId = 10000007;
public int nameCardId = 210001;
public int adventureRank = 1;
public int worldLevel = 0;
public int adventureRank = 60;
public int worldLevel = 8;
public String nickName = "Server";
public String signature = "Welcome to Grasscutter!";
public String signature = "Server Running in "+System.getProperty("os.name");
}
public static class Files {

View File

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

View File

@ -1253,7 +1253,6 @@ public class Player {
this.save();
this.getTeamManager().saveAvatars();
this.getFriendsList().save();
}catch (Throwable e) {
e.printStackTrace();
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 -> {
}
}
tunnel.writeData(packet.build());
}
@Override

View File

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

View File

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