Merge pull request #18 from BoomEaro/fixes

Ability to disable players list. Fixed server starting message for log level < 3
This commit is contained in:
Max 2022-01-30 13:04:46 +02:00 committed by GitHub
commit 416878d160
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 4 deletions

View File

@ -50,6 +50,7 @@ public final class LimboConfig {
private boolean useJoinMessage; private boolean useJoinMessage;
private boolean useBossBar; private boolean useBossBar;
private boolean useTitle; private boolean useTitle;
private boolean usePlayerList;
private String brandName; private String brandName;
private String joinMessage; private String joinMessage;
private BossBar bossBar; private BossBar bossBar;
@ -86,8 +87,9 @@ public final class LimboConfig {
useJoinMessage = conf.node("joinMessage", "enable").getBoolean(); useJoinMessage = conf.node("joinMessage", "enable").getBoolean();
useBossBar = conf.node("bossBar", "enable").getBoolean(); useBossBar = conf.node("bossBar", "enable").getBoolean();
useTitle = conf.node("title", "enable").getBoolean(); useTitle = conf.node("title", "enable").getBoolean();
usePlayerList = conf.node("playerList").getBoolean();
if(useBrandName) if (useBrandName)
brandName = conf.node("brandName", "content").getString(); brandName = conf.node("brandName", "content").getString();
if (useJoinMessage) if (useJoinMessage)
@ -187,6 +189,10 @@ public final class LimboConfig {
return useTitle; return useTitle;
} }
public boolean isUsePlayerList() {
return usePlayerList;
}
public String getBrandName() { public String getBrandName() {
return brandName; return brandName;
} }

View File

@ -239,11 +239,20 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
writePacket(PACKET_JOIN_GAME); writePacket(PACKET_JOIN_GAME);
writePacket(PACKET_PLAYER_ABILITIES); writePacket(PACKET_PLAYER_ABILITIES);
writePacket(PACKET_PLAYER_POS); 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)){ if (clientVersion.moreOrEqual(Version.V1_13)){
writePacket(PACKET_DECLARE_COMMANDS); writePacket(PACKET_DECLARE_COMMANDS);
if (PACKET_PLUGIN_MESSAGE != null) if (PACKET_PLUGIN_MESSAGE != null)
writePacket(PACKET_PLUGIN_MESSAGE); writePacket(PACKET_PLUGIN_MESSAGE);
} }
@ -433,7 +442,9 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
PACKET_JOIN_GAME = PacketSnapshot.of(joinGame); PACKET_JOIN_GAME = PacketSnapshot.of(joinGame);
PACKET_PLAYER_ABILITIES = PacketSnapshot.of(playerAbilities); PACKET_PLAYER_ABILITIES = PacketSnapshot.of(playerAbilities);
PACKET_PLAYER_POS = PacketSnapshot.of(positionAndLook); PACKET_PLAYER_POS = PacketSnapshot.of(positionAndLook);
PACKET_PLAYER_INFO = PacketSnapshot.of(info); PACKET_PLAYER_INFO = PacketSnapshot.of(info);
PACKET_DECLARE_COMMANDS = PacketSnapshot.of(declareCommands); PACKET_DECLARE_COMMANDS = PacketSnapshot.of(declareCommands);
if (server.getConfig().isUseBrandName()){ if (server.getConfig().isUseBrandName()){

View File

@ -67,8 +67,6 @@ public final class LimboServer {
config = new LimboConfig(Paths.get("./")); config = new LimboConfig(Paths.get("./"));
config.load(); config.load();
Logger.setLevel(config.getDebugLevel());
dimensionRegistry = new DimensionRegistry(this); dimensionRegistry = new DimensionRegistry(this);
dimensionRegistry.load(config.getDimensionType()); dimensionRegistry.load(config.getDimensionType());
connections = new Connections(); connections = new Connections();
@ -82,6 +80,8 @@ public final class LimboServer {
Runtime.getRuntime().addShutdownHook(new Thread(this::stop, "NanoLimbo shutdown thread")); Runtime.getRuntime().addShutdownHook(new Thread(this::stop, "NanoLimbo shutdown thread"));
Logger.info("Server started on %s", config.getAddress()); Logger.info("Server started on %s", config.getAddress());
Logger.setLevel(config.getDebugLevel());
} }
private void startBootstrap() { private void startBootstrap() {

View File

@ -19,6 +19,9 @@ ping:
# Available dimensions: OVERWORLD, NETHER, THE_END # Available dimensions: OVERWORLD, NETHER, THE_END
dimension: THE_END dimension: THE_END
# Whether to display the player in the player list
playerList: true
# Spawn position in the world # Spawn position in the world
spawnPosition: spawnPosition:
x: 0.0 x: 0.0