From cffce30a5dc193c96a9cc777f999482c9f29738c Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 25 Feb 2021 04:26:04 +1300 Subject: [PATCH] Have /ld logs more compressed --- .../commands/libsdisguises/LDUploadLogs.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUploadLogs.java b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUploadLogs.java index 30db6276..aa25b9ea 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUploadLogs.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUploadLogs.java @@ -140,7 +140,10 @@ public class LDUploadLogs implements LDCommand { } try { - configText.append(new String(Files.readAllBytes(config.toPath()))); + String text = new String(Files.readAllBytes(config.toPath())); + text = text.replaceAll("\n? *#[^\n]*", "").replaceAll("[\n\r]+", "\n"); + + configText.append("File: ").append(config.getName()).append("\n\n").append(text); } catch (IOException e) { e.printStackTrace(); } @@ -208,10 +211,8 @@ public class LDUploadLogs implements LDCommand { configText.append("\nUsing default config!"); } - String ctext = configText.toString().replaceAll("\n? *#[^\n]*", ""); - URL latestPaste = new GuestPaste("latest.log", latestText).paste(); - URL configPaste = new GuestPaste("LibsDisguises config.yml", ctext).paste(); + URL configPaste = new GuestPaste("LibsDisguises config.yml", configText.toString()).paste(); URL disguisesPaste = new GuestPaste("LibsDisguises disguises.yml", disguiseText).paste(); lastUsed = System.currentTimeMillis(); @@ -226,7 +227,8 @@ public class LDUploadLogs implements LDCommand { sender.sendMessage(ChatColor.GOLD + "Click on the below message to have it appear in your chat input"); } - String text = "My log file: " + latestPaste + ", my combined config files: " + configPaste + " and my disguises file: " + disguisesPaste; + String text = "My log file: " + latestPaste + ", my combined config files: " + configPaste + " and my disguises file: " + + disguisesPaste; ComponentBuilder builder = new ComponentBuilder(""); builder.append(text);