Skip to content

Commit 78358fd

Browse files
committed
Apply analysis tools advise
1 parent 456425e commit 78358fd

File tree

8 files changed

+47
-29
lines changed

8 files changed

+47
-29
lines changed

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private void load3rdParty() {
349349
}
350350
if (getConfiguration().getBoolean("plugin.WorldEdit")) {
351351
String nmsVersion = ReflectFactory.getNMSVersion();
352-
GameVersion gameVersion = GameVersion.get(nmsVersion);
352+
// GameVersion gameVersion = GameVersion.get(nmsVersion);
353353
this.worldEditPlugin = Bukkit.getPluginManager().getPlugin("WorldEdit");
354354
if (this.worldEditPlugin != null) {
355355
this.worldEditAdapter = new WorldEditAdapter(this, (WorldEditPlugin) this.worldEditPlugin);

src/main/java/org/maxgamer/quickshop/listener/InternalListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void shopCreate(ShopCreateEvent event) {
6868
return;
6969
}
7070
if (loggingAction) {
71-
Player creator = plugin.getServer().getPlayer(event.getCreator());
71+
//Player creator = plugin.getServer().getPlayer(event.getCreator());
7272
plugin.logEvent(new ShopCreationLog(event.getCreator(), event.getShop().saveToInfoStorage(), event.getShop().getLocation()));
7373

7474
}

src/main/java/org/maxgamer/quickshop/localization/game/game/distributions/MojangDistribution.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* This file is a part of project QuickShop, the name is MojangDistribution.java
3+
* Copyright (C) PotatoCraft Studio and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License as published by the
7+
* Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*
18+
*/
19+
120
package org.maxgamer.quickshop.localization.game.game.distributions;
221

322
import com.google.common.cache.Cache;
@@ -48,7 +67,6 @@ public MojangDistribution(QuickShop plugin, MojangApiMirror mirror) {
4867
@Nullable
4968
public VersionManifest getVersionManifest() {
5069
String url = mirror.getLauncherMetaRoot() + "/mc/game/version_manifest.json";
51-
String data;
5270
if (requestCachePool.getIfPresent(url) != null) {
5371
return JsonUtil.standard().fromJson(requestCachePool.getIfPresent(url), VersionManifest.class);
5472
}

src/main/java/org/maxgamer/quickshop/shop/ShopLoader.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,16 @@ private boolean shopNullCheck(@Nullable Shop shop) {
205205
return false;
206206
}
207207

208-
private @NotNull Long mean(Long[] m) {
209-
long sum = 0;
210-
for (Long aM : m) {
211-
sum += aM;
212-
}
213-
if (m.length == 0) {
214-
return sum;
215-
}
216-
return sum / m.length;
217-
}
208+
// private @NotNull Long mean(Long[] m) {
209+
// long sum = 0;
210+
// for (Long aM : m) {
211+
// sum += aM;
212+
// }
213+
// if (m.length == 0) {
214+
// return sum;
215+
// }
216+
// return sum / m.length;
217+
// }
218218

219219
@NotNull
220220
private YamlConfiguration extraUpgrade(@NotNull String extraString) {

src/main/java/org/maxgamer/quickshop/shop/ShopSignStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@Data
3131
@Builder
3232
public class ShopSignStorage {
33-
private final boolean shopSign = true;
33+
private final static boolean shopSign = true;
3434
private String world;
3535
private int x;
3636
private int y;

src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import lombok.Getter;
2727
import org.bukkit.Bukkit;
2828
import org.bukkit.plugin.InvalidPluginException;
29-
import org.bukkit.plugin.Plugin;
3029
import org.jetbrains.annotations.NotNull;
3130
import org.jetbrains.annotations.Nullable;
3231
import org.maxgamer.quickshop.QuickShop;
@@ -308,18 +307,18 @@ public void resetIgnores() {
308307
disable = false;
309308
}
310309

311-
private String getPluginInfo() {
312-
StringBuilder buffer = new StringBuilder();
313-
for (Plugin bPlugin : plugin.getServer().getPluginManager().getPlugins()) {
314-
buffer
315-
.append("\t")
316-
.append(bPlugin.getName())
317-
.append("@")
318-
.append(bPlugin.isEnabled() ? "Enabled" : "Disabled")
319-
.append("\n");
320-
}
321-
return buffer.toString();
322-
}
310+
// private String getPluginInfo() {
311+
// StringBuilder buffer = new StringBuilder();
312+
// for (Plugin bPlugin : plugin.getServer().getPluginManager().getPlugins()) {
313+
// buffer
314+
// .append("\t")
315+
// .append(bPlugin.getName())
316+
// .append("@")
317+
// .append(bPlugin.isEnabled() ? "Enabled" : "Disabled")
318+
// .append("\n");
319+
// }
320+
// return buffer.toString();
321+
// }
323322

324323
enum PossiblyLevel {
325324
CONFIRM,

src/main/java/org/maxgamer/quickshop/watcher/LogWatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class LogWatcher extends BukkitRunnable implements AutoCloseable {
4545

4646
private PrintWriter printWriter = null;
4747

48+
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("DM_DEFAULT_ENCODING")
4849
public LogWatcher(QuickShop plugin, File log) {
4950
try {
5051
boolean deleteFailed = false;

src/main/java/org/maxgamer/quickshop/watcher/TpsWatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class TpsWatcher extends BukkitRunnable {
3131
private final LinkedList<Double> history = new LinkedList<>();
3232
@SuppressWarnings("FieldCanBeLocal")
33-
private final long tickInterval = 50;
33+
private final static long TICK_INTERVAL = 50;
3434
private transient long lastPoll = System.nanoTime();
3535

3636
public TpsWatcher() {
@@ -47,7 +47,7 @@ public void run() {
4747
if (history.size() > 10) {
4848
history.remove();
4949
}
50-
final double tps = tickInterval * 1000000.0 / timeSpent;
50+
final double tps = TICK_INTERVAL * 1000000.0 / timeSpent;
5151
if (tps <= 21) {
5252
history.add(tps);
5353
}

0 commit comments

Comments
 (0)