Skip to content

Commit

Permalink
Merge pull request Nan1t#18 from BoomEaro/fixes
Browse files Browse the repository at this point in the history
Ability to disable players list. Fixed server starting message for log level < 3
  • Loading branch information
Nan1t authored Jan 30, 2022
2 parents b77d9b0 + 04c6e1b commit 416878d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/main/java/ru/nanit/limbo/configuration/LimboConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -187,6 +189,10 @@ public boolean isUseTitle() {
return useTitle;
}

public boolean isUsePlayerList() {
return usePlayerList;
}

public String getBrandName() {
return brandName;
}
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/ru/nanit/limbo/connection/ClientConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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()){
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ru/nanit/limbo/server/LimboServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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() {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 416878d

Please sign in to comment.