Skip to content

Commit

Permalink
conditionalize debug messages on debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tadhunt committed Sep 29, 2022
1 parent 39d90d7 commit a1ba8fc
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions src/main/java/com/loohp/limbo/network/ClientConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ public void run() {
state = ClientState.LOGIN;

if (isBungeecord || isBungeeGuard) {
ServerProperties properties = Limbo.getInstance().getServerProperties();
try {
String[] data = bungeeForwarding.split("\\x00");
String host = "";
Expand All @@ -370,8 +371,11 @@ public void run() {
String bungee = "";
String skinData = "";
int state = 0;
for(int i = 0; i < data.length; i++) {
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": " + data[i]);
for (int i = 0; i < data.length; i++) {
if (!properties.isReducedDebugInfo()) {
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": " + data[i]);
}

switch(state) {
default:
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": ignore data: State: " + String.valueOf(state));
Expand Down Expand Up @@ -401,12 +405,17 @@ public void run() {
break;
}
}
if (state != 6) {
throw new IllegalStateException("Illegal bungee state: " + String.valueOf(state));
}

Limbo.getInstance().getConsole().sendMessage("Host: " + host);
Limbo.getInstance().getConsole().sendMessage("Floodgate: " + floodgate);
Limbo.getInstance().getConsole().sendMessage("clientIp: " + clientIp);
Limbo.getInstance().getConsole().sendMessage("bungee: " + bungee);
Limbo.getInstance().getConsole().sendMessage("skinData: " + skinData);
if (!properties.isReducedDebugInfo()) {
Limbo.getInstance().getConsole().sendMessage("Host: " + host);
Limbo.getInstance().getConsole().sendMessage("Floodgate: " + floodgate);
Limbo.getInstance().getConsole().sendMessage("clientIp: " + clientIp);
Limbo.getInstance().getConsole().sendMessage("bungee: " + bungee);
Limbo.getInstance().getConsole().sendMessage("skinData: " + skinData);
}

bungeeUUID = UUID.fromString(bungee.replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5"));
inetAddress = InetAddress.getByName(clientIp);
Expand Down Expand Up @@ -434,10 +443,12 @@ public void run() {
break;
}
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
Limbo.getInstance().getConsole().sendMessage(sw.toString());
if (!properties.isReducedDebugInfo()) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
Limbo.getInstance().getConsole().sendMessage(sw.toString());
}
Limbo.getInstance().getConsole().sendMessage("If you wish to use bungeecord's IP forwarding, please enable that in your bungeecord config.yml as well!");
disconnectDuringLogin(new BaseComponent[] {new TextComponent(ChatColor.RED + "Please connect from the proxy!")});
}
Expand Down

0 comments on commit a1ba8fc

Please sign in to comment.