diff --git a/src/main/java/org/maxgamer/quickshop/Metrics.java b/src/main/java/org/maxgamer/quickshop/Metrics.java
index 7e54c24e9..35ed2f5b7 100644
--- a/src/main/java/org/maxgamer/quickshop/Metrics.java
+++ b/src/main/java/org/maxgamer/quickshop/Metrics.java
@@ -47,7 +47,7 @@ import java.util.zip.GZIPOutputStream;
*
*
Check out https://bStats.org/ to learn more about bStats!
*/
-@SuppressWarnings({"WeakerAccess", "unused"})
+@SuppressWarnings({"WeakerAccess"})
public class Metrics {
// The version of this bStats class
diff --git a/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java b/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java
index fc3a3e55c..a9c85fce9 100644
--- a/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java
+++ b/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java
@@ -20,7 +20,7 @@ public class GriefPreventionIntegration implements IntegratedPlugin {
private final List createLimits = new ArrayList<>(3);
private final List 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();
diff --git a/src/main/java/org/maxgamer/quickshop/listener/ShopProtectionListener.java b/src/main/java/org/maxgamer/quickshop/listener/ShopProtectionListener.java
index 38558a1f3..90f37fbb6 100644
--- a/src/main/java/org/maxgamer/quickshop/listener/ShopProtectionListener.java
+++ b/src/main/java/org/maxgamer/quickshop/listener/ShopProtectionListener.java
@@ -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;
diff --git a/src/main/java/org/maxgamer/quickshop/nonquickshopstuff/com/sk89q/worldedit/util/net/HttpRequest.java b/src/main/java/org/maxgamer/quickshop/nonquickshopstuff/com/sk89q/worldedit/util/net/HttpRequest.java
index 942811c18..437e01f8e 100644
--- a/src/main/java/org/maxgamer/quickshop/nonquickshopstuff/com/sk89q/worldedit/util/net/HttpRequest.java
+++ b/src/main/java/org/maxgamer/quickshop/nonquickshopstuff/com/sk89q/worldedit/util/net/HttpRequest.java
@@ -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;
diff --git a/src/main/java/org/maxgamer/quickshop/util/MsgUtil.java b/src/main/java/org/maxgamer/quickshop/util/MsgUtil.java
index 163efb21d..b480b19eb 100644
--- a/src/main/java/org/maxgamer/quickshop/util/MsgUtil.java
+++ b/src/main/java/org/maxgamer/quickshop/util/MsgUtil.java
@@ -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()) {
diff --git a/src/test/java/org/maxgamer/quickshop/economy/EconomyTransactionTest.java b/src/test/java/org/maxgamer/quickshop/economy/EconomyTransactionTest.java
index ff4e9f518..01589f734 100644
--- a/src/test/java/org/maxgamer/quickshop/economy/EconomyTransactionTest.java
+++ b/src/test/java/org/maxgamer/quickshop/economy/EconomyTransactionTest.java
@@ -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 playerBalanceMap = new HashMap<>(10);
+ final Map playerBalanceMap = new HashMap<>(10);
private Double getOrCreateAccount(UUID uuid) {
if (!playerBalanceMap.containsKey(uuid)) {