Fix FileUtils being referenced when it's not compatible with 1.12 and other alternatives exist

This commit is contained in:
libraryaddict 2020-05-02 02:08:43 +12:00
parent 301617c0f3
commit 669dbbeb78
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 4 additions and 5 deletions

View File

@ -27,7 +27,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.libs.org.apache.commons.io.FileUtils;
import org.bukkit.entity.Entity;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
@ -528,8 +527,7 @@ public class DisguiseConfig {
try {
if (config.exists()) {
FileUtils.copyFile(config, new File(config.getParentFile(), "config-old.yml"));
config.delete();
config.renameTo(new File(config.getParentFile(), "config-old.yml"));
DisguiseUtilities.getLogger().info("Old config has been copied to config-old.yml");
}

View File

@ -9,7 +9,6 @@ import me.libraryaddict.disguise.utilities.plugin.PluginInformation;
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.libs.org.apache.commons.io.FileUtils;
import org.bukkit.entity.Player;
import java.io.BufferedReader;
@ -19,6 +18,8 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@ -232,7 +233,7 @@ public class UpdateChecker {
// Get the input stream, what we receive
try (InputStream input = con.getInputStream()) {
FileUtils.copyInputStreamToFile(input, dest);
Files.copy(input, dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
DisguiseUtilities.getLogger().info("Download success!");