Modernize code

This commit is contained in:
GeorgH93 2023-06-27 21:12:49 +02:00
parent e081c66212
commit 940e2a4b13
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 4 additions and 3 deletions

View File

@ -47,6 +47,7 @@
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;
public class DebugCommand extends MinepacksCommand
@ -85,7 +86,7 @@ public void execute(@NotNull CommandSender commandSender, @NotNull String mainCo
{
plugin.getLogger().warning("Unable to delete debug.txt file!");
}
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(debugFile), StandardCharsets.UTF_8));
writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(debugFile.toPath()), StandardCharsets.UTF_8));
writer.append(plugin.getDescription().getName()).append(" Version: ").append(plugin.getDescription().getVersion());
writer.append("\nServer: ").append(Bukkit.getServer().getBukkitVersion()).append(" (").append(Bukkit.getServer().getVersion()).append(")");
@ -98,7 +99,7 @@ public void execute(@NotNull CommandSender commandSender, @NotNull String mainCo
writer.append(p.getName()).append(' ').append(p.getDescription().getVersion()).append('\n');
}
writer.append("\nPlugin Config:\n");
try(BufferedReader configReader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "config.yml")), StandardCharsets.UTF_8)))
try(BufferedReader configReader = new BufferedReader(new InputStreamReader(Files.newInputStream(new File(plugin.getDataFolder(), "config.yml").toPath()), StandardCharsets.UTF_8)))
{
String line;
while((line = configReader.readLine()) != null)

View File

@ -7,7 +7,7 @@
<packaging>pom</packaging>
<properties>
<revision>2.4.20.4</revision>
<revision>2.4.21-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>