Skip to content

Add flag to modify the maximum amount of usable ServerLinks #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading