Cleanup some misc stuff

This commit is contained in:
Luck 2017-03-26 16:10:49 +01:00
parent 14cb34ac95
commit 486b19aa90
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
3 changed files with 8 additions and 7 deletions

View File

@ -22,16 +22,16 @@
package me.lucko.luckperms.common.locale; package me.lucko.luckperms.common.locale;
import lombok.Cleanup;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Map; import java.util.Map;
public class SimpleLocaleManager implements LocaleManager { public class SimpleLocaleManager implements LocaleManager {
@ -40,8 +40,9 @@ public class SimpleLocaleManager implements LocaleManager {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void loadFromFile(File file) throws Exception { public void loadFromFile(File file) throws Exception {
@Cleanup FileReader fileReader = new FileReader(file); try (BufferedReader reader = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) {
translations = ImmutableMap.copyOf((Map<String, String>) new Yaml().load(fileReader)); translations = ImmutableMap.copyOf((Map<String, String>) new Yaml().load(reader));
}
} }
@Override @Override

View File

@ -33,7 +33,7 @@ import me.lucko.luckperms.api.context.ImmutableContextSet;
@Getter @Getter
@EqualsAndHashCode @EqualsAndHashCode
@ToString @ToString
public class ExtractedContexts { public final class ExtractedContexts {
public static ExtractedContexts generate(Contexts contexts) { public static ExtractedContexts generate(Contexts contexts) {
return new ExtractedContexts(contexts); return new ExtractedContexts(contexts);
} }

View File

@ -70,7 +70,7 @@ public class PasteUtils {
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setDoOutput(true); connection.setDoOutput(true);
try (OutputStream os = connection.getOutputStream()) { try (OutputStream os = connection.getOutputStream()) {
os.write(("url=" + pasteUrl).getBytes()); os.write(("url=" + pasteUrl).getBytes(StandardCharsets.UTF_8));
} }
pasteUrl = connection.getHeaderField("Location"); pasteUrl = connection.getHeaderField("Location");
connection.disconnect(); connection.disconnect();