Skip to content

Commit 032fd8a

Browse files
author
Kaleidox
committed
fix file flag inheritance and typo
1 parent bc97849 commit 032fd8a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/java/org/comroid/api/io/FileFlag.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@ public class FileFlag {
1313

1414
@SneakyThrows
1515
public static boolean enable(File file) {
16+
if (!file.isAbsolute()) file = file.getAbsoluteFile();
1617
return cache.containsKey(file) && cache.get(file).enable();
1718
}
1819

1920
public static boolean consume(File file) {
21+
if (!file.isAbsolute()) file = file.getAbsoluteFile();
2022
return cache.containsKey(file) && cache.get(file).consume();
2123
}
2224

2325
File file;
2426

27+
public FileFlag(File file) {
28+
this.file = file.getAbsoluteFile();
29+
}
30+
2531
@SneakyThrows
2632
public boolean enable() {
27-
if (!file.isAbsolute()) return enable(file.getAbsoluteFile());
2833
return file.exists() || file.createNewFile();
2934
}
3035

3136
public boolean consume() {
32-
if (!file.isAbsolute()) return consume(file.getAbsoluteFile());
3337
return file.exists() && file.delete();
3438
}
3539
}

src/main/java/org/comroid/interaction/adapter/jda/DiscordCommandRegistrator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void initialize() {
8888
log.info("Upserting %d interactions to discord bot %s".formatted(all.size(), jda.getSelfUser()));
8989

9090
RestAction<?> action = PURGE_COMMANDS.consume() ? jda.retrieveCommands().flatMap(cmds -> {
91-
log.fine("Puring %d previously defined commands".formatted(cmds.size()));
91+
log.fine("Purging %d previously defined commands".formatted(cmds.size()));
9292

9393
RestAction<?> sub = new CompletedRestAction<>(jda, (Object) null);
9494
for (var cmd : cmds)

0 commit comments

Comments
 (0)