mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
Modernize code
This commit is contained in:
parent
e081c66212
commit
940e2a4b13
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user