Skip to content
Open
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Enable `hackEarlySend` will use mixin for early send packet to velocity.
* Start server to generate config
* Setting velocity `player-info-forwarding-mode` to `modern` and `forwarding-secret`
* Setting `secret` in `config/FabricProxy-Lite.toml` match velocity config

10 changes: 10 additions & 0 deletions src/main/java/one/oktw/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public class ModConfig {
private boolean hackOnlineMode = true;
private boolean hackEarlySend = false;
private boolean hackMessageChain = true;
private boolean allowBypassProxy = false;
private String secret = "";

public boolean getHackOnlineMode() {
Expand Down Expand Up @@ -33,6 +34,15 @@ public boolean getHackMessageChain() {
return Boolean.parseBoolean(env);
}
}

public boolean getallowBypassProxy() {
String env = System.getenv("ALLOW_BYPASS_PROXY");
if (env == null) {
return allowBypassProxy;
} else {
return Boolean.parseBoolean(env);
}
}

public String getSecret() {
String env = System.getenv("FABRIC_PROXY_SECRET");
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/one/oktw/PacketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class PacketHandler {
PacketHandler(ModConfig config) {
this.config = config;
}

void handleVelocityPacket(MinecraftServer server, ServerLoginNetworkHandler handler, boolean understood, PacketByteBuf buf, ServerLoginNetworking.LoginSynchronizer synchronizer, PacketSender ignored) {
if (!understood) {
if (!understood && config.getallowBypassProxy() == false) {
handler.disconnect(Text.of("This server requires you to connect with Velocity."));
return;
}
Expand Down