причина отключения от сервера в конфиге
This commit is contained in:
@@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import mc.protocol.NettyServer;
|
||||
import mc.protocol.ProtocolConstant;
|
||||
import mc.protocol.model.ServerInfo;
|
||||
import mc.protocol.model.text.Text;
|
||||
import mc.protocol.packets.PingPacket;
|
||||
import mc.protocol.packets.client.HandshakePacket;
|
||||
import mc.protocol.packets.client.LoginStartPacket;
|
||||
@@ -78,7 +77,7 @@ public class Main {
|
||||
.doOnNext(channel -> log.info("{}", channel.getPacket()))
|
||||
.subscribe(channel -> {
|
||||
DisconnectPacket disconnectPacket = new DisconnectPacket();
|
||||
disconnectPacket.setReason(Text.of("Server is not available."));
|
||||
disconnectPacket.setReason(TextSerializer.fromPlain(config.disconnectReason()));
|
||||
|
||||
channel.getCtx().writeAndFlush(disconnectPacket).channel().disconnect();
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ public class Config {
|
||||
private final Players players = new Players();
|
||||
|
||||
private String motd;
|
||||
private String disconnectReason;
|
||||
private Path iconPath;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -28,6 +28,7 @@ public class ConfigModule {
|
||||
config.server().host(fromYamlPath("server/host", map, "127.0.0.1"));
|
||||
config.server().port(fromYamlPath("server/port", map, 25565));
|
||||
config.motd(fromYamlPath("motd", map, ""));
|
||||
config.disconnectReason(fromYamlPath("disconnect-reason", map, ""));
|
||||
config.players().maxOnlile(fromYamlPath("players/max-online", map, 0));
|
||||
config.players().onlile(fromYamlPath("players/online", map, 0));
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ motd: |
|
||||
&bmc-project &8:: &4ZERO
|
||||
&8develop by &7DmitriyMX
|
||||
|
||||
disconnect-reason: '&4Server is not available.'
|
||||
|
||||
players:
|
||||
max-online: 0
|
||||
online: 0
|
||||
|
||||
Reference in New Issue
Block a user