Skip to content

Commit 79e537f

Browse files
committed
fix: bug in migration logic v1
1 parent 8877b99 commit 79e537f

7 files changed

Lines changed: 19 additions & 21 deletions

File tree

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ java {
99
}
1010

1111
group = 'me.playbosswar.com'
12-
version = '8.16.0'
12+
version = '8.16.1'
1313
description = 'CommandTimer'
1414

1515
repositories {
@@ -74,7 +74,7 @@ publishing {
7474
maven(MavenPublication) {
7575
groupId = 'me.playbosswar.com'
7676
artifactId = 'commandtimer'
77-
version = '8.16.0'
77+
version = '8.16.1'
7878

7979
from components.java
8080
}

java17-build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ java {
1010

1111

1212
group = 'me.playbosswar.com'
13-
version = '8.16.0'
13+
version = '8.16.1'
1414
description = 'CommandTimer'
1515

1616
repositories {
@@ -63,7 +63,7 @@ publishing {
6363
maven(MavenPublication) {
6464
groupId = 'me.playbosswar.com'
6565
artifactId = 'commandtimer-java17'
66-
version = '8.16.0'
66+
version = '8.16.1'
6767

6868
from components.java
6969
}

java21-build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ java {
1010

1111

1212
group = 'me.playbosswar.com'
13-
version = '8.16.0'
13+
version = '8.16.1'
1414
description = 'CommandTimer'
1515

1616
repositories {
@@ -67,7 +67,7 @@ publishing {
6767
maven(MavenPublication) {
6868
groupId = 'me.playbosswar.com'
6969
artifactId = 'commandtimer-java21'
70-
version = '8.16.0'
70+
version = '8.16.1'
7171
from components.java
7272
}
7373
}

src/main/java/me/playbosswar/com/CommandTimerPlugin.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ public void onEnable() {
125125

126126
@Override
127127
public void onDisable() {
128-
tasksManager.disable();
128+
if(tasksManager != null) {
129+
tasksManager.disable();
130+
}
129131
if(adHocCommandsManager != null) {
130132
adHocCommandsManager.disable();
131133
}
132-
conditionEngineManager.onDisable();
134+
if(conditionEngineManager != null) {
135+
conditionEngineManager.onDisable();
136+
}
133137
saveDefaultConfig();
134138
plugin = null;
135139
}

src/main/java/me/playbosswar/com/tasks/Task.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -348,18 +348,12 @@ public void storeInstance() {
348348
transaction.setContext("task", json);
349349

350350
try {
351-
String path;
352-
File existingFile = null;
353-
try {
354-
path = Files.getTaskFile(id);
355-
existingFile = new File(path);
356-
} catch (IllegalStateException e) {
357-
path = Files.getNewTaskFile(id);
358-
}
351+
String path = Files.getTaskFile(id);
352+
File existingFile = new File(path);
359353

360354
JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
361355

362-
if (existingFile != null && existingFile.exists()) {
356+
if (existingFile.exists()) {
363357
try (FileReader fr = new FileReader(existingFile)) {
364358
JsonObject existingJson = new JsonParser().parse(fr).getAsJsonObject();
365359
if (existingJson.has("configVersion")) {

src/main/java/me/playbosswar/com/utils/Files.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ public static String getTaskFile(UUID id) {
123123
if (file != null) {
124124
return file.getAbsolutePath();
125125
}
126-
throw new IllegalStateException("Task file not found for UUID: " + id);
126+
return getNewTaskFile(id);
127127
}
128128

129129
public static String getTaskLocalExecutionFile(UUID id) {
130130
File file = findMetadataFileByUuid(id);
131131
if (file != null) {
132132
return file.getAbsolutePath();
133133
}
134-
throw new IllegalStateException("Task metadata file not found for UUID: " + id);
134+
return getNewTaskLocalExecutionFile(id);
135135
}
136136

137137
public static String getNewTaskFile(UUID id) {
@@ -151,7 +151,7 @@ public static String getAdHocCommandFile(UUID id) {
151151
if (file != null) {
152152
return file.getAbsolutePath();
153153
}
154-
throw new IllegalStateException("Ad-hoc command file not found for UUID: " + id);
154+
return getNewAdHocCommandFile(id);
155155
}
156156

157157
public static String getNewAdHocCommandFile(UUID id) {

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
main: me.playbosswar.com.CommandTimerPlugin
22
name: "CommandTimer"
3-
version: "8.16.0"
3+
version: "8.16.1"
44
description: "Schedule commands like you want"
55
author: PlayBossWar
66
api-version: 1.13

0 commit comments

Comments
 (0)