Skip to content

Commit 3b5d403

Browse files
committed
engage the shutdown exception
1 parent 4f141fd commit 3b5d403

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,12 @@ public final void onDisable() {
676676
if (calendarWatcher != null) {
677677
calendarWatcher.stop();
678678
}
679-
tpsWatcher.cancel();
679+
680+
try {
681+
tpsWatcher.cancel();
682+
} catch (IllegalStateException ignored) {
683+
}
684+
680685
/* Unload UpdateWatcher */
681686
if (this.updateWatcher != null) {
682687
this.updateWatcher.uninit();

src/main/java/org/maxgamer/quickshop/util/envcheck/EnvironmentChecker.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ public ResultReport run(EnvCheckEntry.Stage stage) {
9090
Map<EnvCheckEntry, ResultContainer> results = new LinkedHashMap<>();
9191
boolean skipAllTest = false;
9292
ResultContainer executeResult = null;
93-
CheckResult result = CheckResult.PASSED;
94-
Properties properties = System.getProperties();
9593

94+
Properties properties = System.getProperties();
95+
CheckResult gResult = CheckResult.PASSED;
9696
for (Method declaredMethod : this.tests) {
9797
if (skipAllTest) {
9898
break;
9999
}
100+
CheckResult result = CheckResult.PASSED;
100101
try {
101102
EnvCheckEntry envCheckEntry = declaredMethod.getAnnotation(EnvCheckEntry.class);
102103
if (Arrays.stream(envCheckEntry.stage()).noneMatch(entry -> entry == stage)) {
@@ -145,12 +146,15 @@ public ResultReport run(EnvCheckEntry.Stage stage) {
145146
} else {
146147
results.put(envCheckEntry, new ResultContainer(CheckResult.SKIPPED, "Startup flag mark this check should be skipped."));
147148
}
149+
if (result.ordinal() > gResult.ordinal()) { //set bad result if its worse than the latest one.
150+
gResult = result;
151+
}
148152
} catch (Exception e) {
149153
plugin.getLogger().log(Level.WARNING, "Failed to execute EnvCheckEntry [" + declaredMethod.getName() + "]: Exception thrown out without getting caught. Something went wrong!", e);
150154
plugin.getLogger().warning("[FAIL] " + declaredMethod.getName());
151155
}
152156
}
153-
return new ResultReport(result, results);
157+
return new ResultReport(gResult, results);
154158
}
155159

156160
public boolean isOutdatedJvm() {

0 commit comments

Comments
 (0)