Skip to content

Commit

Permalink
Add flag to modify the maximum amount of usable ServerLinks (#85)
Browse files Browse the repository at this point in the history
* Add flag for the maximum amount of ServerLinks

* Update constant usage
  • Loading branch information
Joltras authored Oct 21, 2024
1 parent 698e88a commit 369e660
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/net/minestom/server/ServerFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public final class ServerFlag {
public static final int POOLED_BUFFER_SIZE = intProperty("minestom.pooled-buffer-size", 262_143);
public static final int SEND_LIGHT_AFTER_BLOCK_PLACEMENT_DELAY = intProperty("minestom.send-light-after-block-placement-delay", 100);
public static final long LOGIN_PLUGIN_MESSAGE_TIMEOUT = longProperty("minestom.login-plugin-message-timeout", 5_000);
public static final int SERVER_LINK_AMOUNT = intProperty("minestom.server-link-amount", 100);

// Network rate limiting
public static final int PLAYER_PACKET_PER_TICK = intProperty("minestom.packet-per-tick", 50);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.minestom.server.network.packet.server.common;

import net.kyori.adventure.text.Component;
import net.minestom.server.ServerFlag;
import net.minestom.server.network.NetworkBuffer;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
Expand All @@ -11,7 +12,6 @@
import java.util.List;

public record ServerLinksPacket(@NotNull List<Entry> entries) implements ServerPacket.Configuration, ServerPacket.Play {
private static final int MAX_ENTRIES = 100;

public ServerLinksPacket {
entries = List.copyOf(entries);
Expand Down Expand Up @@ -64,7 +64,7 @@ public Entry read(@NotNull NetworkBuffer buffer) {
}
}
};
public static final NetworkBuffer.Type<List<Entry>> LIST_NETWORK_TYPE = NETWORK_TYPE.list(MAX_ENTRIES);
public static final NetworkBuffer.Type<List<Entry>> LIST_NETWORK_TYPE = NETWORK_TYPE.list(ServerFlag.SERVER_LINK_AMOUNT);

public Entry {
Check.argCondition(knownType == null && customType == null, "One of knownType and customType must be present");
Expand Down

0 comments on commit 369e660

Please sign in to comment.