mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-23 20:49:57 +08:00
Format code [skip actions]
This commit is contained in:
@@ -56,9 +56,7 @@ import org.jetbrains.annotations.*;
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class GameServer implements Iterable<Player> {
|
||||
/**
|
||||
* This can be set by plugins to change the network transport implementation.
|
||||
*/
|
||||
/** This can be set by plugins to change the network transport implementation. */
|
||||
@Setter private static Class<? extends INetworkTransport> transport = NetworkTransportImpl.class;
|
||||
|
||||
// Game server base
|
||||
@@ -145,9 +143,7 @@ public final class GameServer implements Iterable<Player> {
|
||||
// Create the network transport.
|
||||
INetworkTransport transport;
|
||||
try {
|
||||
transport = GameServer.transport
|
||||
.getDeclaredConstructor()
|
||||
.newInstance();
|
||||
transport = GameServer.transport.getDeclaredConstructor().newInstance();
|
||||
} catch (Exception ex) {
|
||||
log.error("Failed to create network transport.", ex);
|
||||
transport = new NetworkTransportImpl();
|
||||
|
||||
@@ -74,8 +74,9 @@ public class GameSession implements IGameSession {
|
||||
}
|
||||
|
||||
public void logPacket(String sendOrRecv, int opcode, byte[] payload) {
|
||||
this.session.getLogger().info("{}: {} ({})",
|
||||
sendOrRecv, PacketOpcodesUtils.getOpcodeName(opcode), opcode);
|
||||
this.session
|
||||
.getLogger()
|
||||
.info("{}: {} ({})", sendOrRecv, PacketOpcodesUtils.getOpcodeName(opcode), opcode);
|
||||
if (GAME_INFO.isShowPacketPayload) System.out.println(Utils.bytesToHex(payload));
|
||||
}
|
||||
|
||||
@@ -151,7 +152,9 @@ public class GameSession implements IGameSession {
|
||||
int const1 = packet.readShort();
|
||||
if (const1 != 17767) {
|
||||
if (allDebug) {
|
||||
this.session.getLogger().error("Invalid packet header received: got {}, expected 17767", const1);
|
||||
this.session
|
||||
.getLogger()
|
||||
.error("Invalid packet header received: got {}, expected 17767", const1);
|
||||
}
|
||||
return; // Bad packet
|
||||
}
|
||||
@@ -169,7 +172,9 @@ public class GameSession implements IGameSession {
|
||||
int const2 = packet.readShort();
|
||||
if (const2 != -30293) {
|
||||
if (allDebug) {
|
||||
this.session.getLogger().error("Invalid packet footer received: got {}, expected -30293", const2);
|
||||
this.session
|
||||
.getLogger()
|
||||
.error("Invalid packet footer received: got {}, expected -30293", const2);
|
||||
}
|
||||
return; // Bad packet
|
||||
}
|
||||
|
||||
@@ -3,14 +3,12 @@ package emu.grasscutter.server.game;
|
||||
public interface IGameSession {
|
||||
/**
|
||||
* Invoked when the server establishes a connection to the client.
|
||||
* <p>
|
||||
* This is invoked after the KCP handshake is completed.
|
||||
*
|
||||
* <p>This is invoked after the KCP handshake is completed.
|
||||
*/
|
||||
void onConnected();
|
||||
|
||||
/**
|
||||
* Invoked when the server loses connection to the client.
|
||||
*/
|
||||
/** Invoked when the server loses connection to the client. */
|
||||
void onDisconnected();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user