Skip to content

Commit

Permalink
RC 4. Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
minecraft8997 committed Jan 10, 2023
1 parent 64941ae commit 65c8cf1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
19 changes: 14 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
plugins {
id 'java'
id 'application'
}

group = 'ru.deewend.banallbot'
version = '2.0.0'

application {
mainClass = 'ru.deewend.banallbot.Main'
}

repositories {
mavenCentral()
maven {
Expand All @@ -25,6 +21,19 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
}

jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)

//noinspection GroovyAssignabilityCheck
manifest {
attributes('Main-Class': 'ru.deewend.banallbot.Main')
}

from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}

task(runMain, dependsOn: 'classes', type: JavaExec) {
//noinspection GrDeprecatedAPIUsage
main = 'ru.deewend.banallbot.Main'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 0 additions & 4 deletions src/META-INF/MANIFEST.MF

This file was deleted.

1 change: 0 additions & 1 deletion src/main/java/ru/deewend/banallbot/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static boolean sleep(long millis) {

return true;
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();

return false;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/ru/deewend/banallbot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public static void main(String[] args) throws Exception {

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
Database.getInstance().interruptHelperThread();
System.out.println("Saving database...");
try {
Database.getInstance().save();
} catch (IOException e) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ru/deewend/banallbot/database/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static Database getInstance() {
//noinspection ResultOfMethodCallIgnored
DB_FILE.createNewFile();
dataMap = new HashMap<>();
unsavedChanges = true;

return;
}
Expand All @@ -59,9 +60,9 @@ public void startHelperThread() {
if (helperThread != null) throw new IllegalStateException();

helperThread = new Thread(() -> {
while (true) {
global: while (true) {
for (int i = 0; i < 3; i++) {
if (!Helper.sleep(3600 * 1000)) break; // 1 hour
if (!Helper.sleep(3600 * 1000)) break global; // 1 hour

refreshLeaderboards(false);
}
Expand Down

0 comments on commit 65c8cf1

Please sign in to comment.