diff --git a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java index c55daeda..aac08c6b 100644 --- a/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java +++ b/src/main/java/ru/nanit/limbo/configuration/LimboConfig.java @@ -50,6 +50,7 @@ public final class LimboConfig { private boolean useJoinMessage; private boolean useBossBar; private boolean useTitle; + private boolean usePlayerList; private String brandName; private String joinMessage; private BossBar bossBar; @@ -86,8 +87,9 @@ public void load() throws Exception { useJoinMessage = conf.node("joinMessage", "enable").getBoolean(); useBossBar = conf.node("bossBar", "enable").getBoolean(); useTitle = conf.node("title", "enable").getBoolean(); + usePlayerList = conf.node("playerList").getBoolean(); - if(useBrandName) + if (useBrandName) brandName = conf.node("brandName", "content").getString(); if (useJoinMessage) @@ -187,6 +189,10 @@ public boolean isUseTitle() { return useTitle; } + public boolean isUsePlayerList() { + return usePlayerList; + } + public String getBrandName() { return brandName; } diff --git a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java index ea9eb1e5..affc76c5 100644 --- a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java +++ b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java @@ -239,11 +239,20 @@ private void fireLoginSuccess() { writePacket(PACKET_JOIN_GAME); writePacket(PACKET_PLAYER_ABILITIES); writePacket(PACKET_PLAYER_POS); - writePacket(PACKET_PLAYER_INFO); + + if (clientVersion.moreOrEqual(Version.V1_17)) { + if (server.getConfig().isUsePlayerList()) { + writePacket(PACKET_PLAYER_INFO); + } + } + else { + writePacket(PACKET_PLAYER_INFO); + } if (clientVersion.moreOrEqual(Version.V1_13)){ writePacket(PACKET_DECLARE_COMMANDS); + if (PACKET_PLUGIN_MESSAGE != null) writePacket(PACKET_PLUGIN_MESSAGE); } @@ -433,7 +442,9 @@ public static void initPackets(LimboServer server) { PACKET_JOIN_GAME = PacketSnapshot.of(joinGame); PACKET_PLAYER_ABILITIES = PacketSnapshot.of(playerAbilities); PACKET_PLAYER_POS = PacketSnapshot.of(positionAndLook); + PACKET_PLAYER_INFO = PacketSnapshot.of(info); + PACKET_DECLARE_COMMANDS = PacketSnapshot.of(declareCommands); if (server.getConfig().isUseBrandName()){ diff --git a/src/main/java/ru/nanit/limbo/server/LimboServer.java b/src/main/java/ru/nanit/limbo/server/LimboServer.java index bacbdae2..8cd38f7d 100644 --- a/src/main/java/ru/nanit/limbo/server/LimboServer.java +++ b/src/main/java/ru/nanit/limbo/server/LimboServer.java @@ -67,8 +67,6 @@ public void start() throws Exception { config = new LimboConfig(Paths.get("./")); config.load(); - Logger.setLevel(config.getDebugLevel()); - dimensionRegistry = new DimensionRegistry(this); dimensionRegistry.load(config.getDimensionType()); connections = new Connections(); @@ -82,6 +80,8 @@ public void start() throws Exception { Runtime.getRuntime().addShutdownHook(new Thread(this::stop, "NanoLimbo shutdown thread")); Logger.info("Server started on %s", config.getAddress()); + + Logger.setLevel(config.getDebugLevel()); } private void startBootstrap() { diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml index e47477dc..4ef7cb86 100644 --- a/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -19,6 +19,9 @@ ping: # Available dimensions: OVERWORLD, NETHER, THE_END dimension: THE_END +# Whether to display the player in the player list +playerList: true + # Spawn position in the world spawnPosition: x: 0.0