From 9cde4702f68b6c707441e5fd4b5abd034b4c926e Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 2 Jul 2020 08:24:55 +1200 Subject: [PATCH] Fix /ld uploadlogs --- .../disguise/commands/libsdisguises/LDUploadLogs.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 e0b47e62..eff6fcb1 100644 --- a/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUploadLogs.java +++ b/src/main/java/me/libraryaddict/disguise/commands/libsdisguises/LDUploadLogs.java @@ -9,7 +9,6 @@ import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.craftbukkit.libs.org.apache.commons.io.FileUtils; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -17,6 +16,7 @@ import javax.net.ssl.HttpsURLConnection; import java.io.*; import java.net.URL; import java.net.URLEncoder; +import java.nio.file.Files; import java.util.AbstractMap.SimpleEntry; import java.util.Collections; import java.util.LinkedList; @@ -139,7 +139,7 @@ public class LDUploadLogs implements LDCommand { } try { - String latestText = FileUtils.readFileToString(latest, "UTF-8"); + String latestText = new String(Files.readAllBytes(latest.toPath())); boolean valid = false; int lastFind = 0; @@ -176,8 +176,8 @@ public class LDUploadLogs implements LDCommand { @Override public void run() { try { - String disguiseText = FileUtils.readFileToString(disguises, "UTF-8"); - StringBuilder configText = new StringBuilder(FileUtils.readFileToString(config, "UTF-8")); + String disguiseText = new String(Files.readAllBytes(disguises.toPath())); + StringBuilder configText = new StringBuilder(new String(Files.readAllBytes(config.toPath()))); configText.append("\n\n"); @@ -230,6 +230,7 @@ public class LDUploadLogs implements LDCommand { } } + private boolean isTooBig(File file) { return file.exists() && file.length() >= 512 * 1024; }