Apply IDE suggestions

Former-commit-id: eaecea5ac17917f4e10d22a8bba1640338e67ac4
This commit is contained in:
sandtechnology committed 2020-11-13 15:00:25 +08:00
1 parent 020ef861d1
commit f3ebced4cd
6 files changed
+9 -17

No files matched your search

@@ -47,7 +47,7 @@ import java.util.zip.GZIPOutputStream;
*
* <p>Check out https://bStats.org/ to learn more about bStats!
*/
@SuppressWarnings({"WeakerAccess", "unused"})
@SuppressWarnings({"WeakerAccess"})
public class Metrics {
// The version of this bStats class
@@ -20,7 +20,7 @@ public class GriefPreventionIntegration implements IntegratedPlugin {
private final List<Flag> createLimits = new ArrayList<>(3);
private final List<Flag> tradeLimits = new ArrayList<>(3);
private final boolean whiteList;
GriefPrevention griefPrevention = GriefPrevention.instance;
final GriefPrevention griefPrevention = GriefPrevention.instance;
public GriefPreventionIntegration(QuickShop plugin) {
ConfigurationSection configurationSection = plugin.getConfig();
@@ -43,7 +43,6 @@ import org.maxgamer.quickshop.util.Util;
import java.util.List;
@SuppressWarnings("DuplicatedCode")
public class ShopProtectionListener extends ProtectionListenerBase {
private final boolean useEnhanceProtection;
@@ -310,15 +310,12 @@ public class HttpRequest implements Closeable {
* @throws InterruptedException on interruption
*/
public HttpRequest saveContent(File file) throws IOException, InterruptedException {
Closer closer = Closer.create();
try {
try (Closer closer = Closer.create()) {
FileOutputStream fos = closer.register(new FileOutputStream(file));
BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos));
saveContent(bos);
} finally {
closer.close();
}
return this;
@@ -446,7 +443,7 @@ public class HttpRequest implements Closeable {
/**
* Used to buffer the response in memory.
*/
public class BufferedResponse {
public static class BufferedResponse {
private final byte[] data;
private BufferedResponse(byte[] data) {
@@ -482,16 +479,13 @@ public class HttpRequest implements Closeable {
* @throws InterruptedException on interruption
*/
public BufferedResponse saveContent(File file) throws IOException, InterruptedException {
Closer closer = Closer.create();
file.getParentFile().mkdirs();
try {
try (Closer closer = Closer.create()) {
file.getParentFile().mkdirs();
FileOutputStream fos = closer.register(new FileOutputStream(file));
BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos));
saveContent(bos);
} finally {
closer.close();
}
return this;
@@ -1062,7 +1062,6 @@ public class MsgUtil {
}
@SneakyThrows
@SuppressWarnings("UnusedAssignment")
private static void updateMessages(int selectedVersion) {
String languageName = plugin.getConfig().getString("language", "en");
if (!messagei18n.getString("language-name").isPresent()) {
@@ -36,8 +36,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class EconomyTransactionTest {
static EconomyCore economy = new TestEconomy();
static UUID taxAccount = UUID.randomUUID();
static final EconomyCore economy = new TestEconomy();
static final UUID taxAccount = UUID.randomUUID();
static {
economy.getBalance(taxAccount);
@@ -106,7 +106,7 @@ public class EconomyTransactionTest {
static class TestEconomy implements EconomyCore {
Map<UUID, Double> playerBalanceMap = new HashMap<>(10);
final Map<UUID, Double> playerBalanceMap = new HashMap<>(10);
private Double getOrCreateAccount(UUID uuid) {
if (!playerBalanceMap.containsKey(uuid)) {