Skip to content

Commit

Permalink
Support to change disconnect message when joining server.
Browse files Browse the repository at this point in the history
  • Loading branch information
wifi-left committed Aug 12, 2023
1 parent 258d0ee commit d49fe8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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,8 +5,18 @@ public class ModConfig {
private boolean hackOnlineMode = true;
private boolean hackEarlySend = false;
private boolean hackMessageChain = true;
private String disconnectMessage = "This server requires you to connect with Velocity.";
private String secret = "";

public String getAbortedMessage() {
String env = System.getenv("FABRIC_PROXY_MESSAGE");
if (env == null) {
return disconnectMessage;
} else {
return (env);
}
}

public boolean getHackOnlineMode() {
String env = System.getenv("FABRIC_PROXY_HACK_ONLINE_MODE");
if (env == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/one/oktw/PacketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PacketHandler {

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

Expand Down

0 comments on commit d49fe8f

Please sign in to comment.