Ensures UTF-8 usage in LootManager

Probably doesn't affect anything as this file should only contain english letters
but just in case for the sake of tidyness
This commit is contained in:
Christian Koop 2023-01-08 12:47:27 +01:00
parent 339a4d6f6c
commit dc64c29da7
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -12,10 +12,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -166,7 +166,7 @@ public class LootManager {
try {
Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader(file.getPath()));
JsonReader reader = new JsonReader(Files.newBufferedReader(file.toPath()));
Lootable lootable = gson.fromJson(reader, Lootable.class);
@ -195,7 +195,7 @@ public class LootManager {
continue;
}
try (Writer writer = new FileWriter(file.getPath())) {
try (Writer writer = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
gson.toJson(lootable, writer);
}