Skip to content

Commit

Permalink
Merge pull request #94 from colorfulFlames/release/5.0.1
Browse files Browse the repository at this point in the history
Release/5.0.1
  • Loading branch information
SeveralCircles authored Nov 9, 2021
2 parents 4751e83 + b2ed8f1 commit 7b903bd
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 14 deletions.
Binary file modified .gradle/7.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

mainClassName = 'com.severalcircles.flames.Flames'
version '5.0-beta-2'
version '5.0.1'
def jdaVersion = '4.3.0_277'

sourceCompatibility = targetCompatibility = 1.8
Expand Down
Binary file not shown.
Binary file removed build/libs/Flames-4.2-all.jar
Binary file not shown.
Binary file removed build/libs/Flames-4.2-plain.jar
Binary file not shown.
Binary file removed build/libs/Flames-4.2.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion build/scripts/Flames
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/lib/Flames-5.0-beta-2.jar:$APP_HOME/lib/JDA-4.3.0_277.jar:$APP_HOME/lib/google-cloud-language-2.0.2.jar:$APP_HOME/lib/bugsnag-3.6.2.jar:$APP_HOME/lib/protobuf-java-3.17.3.jar:$APP_HOME/lib/protobuf-java-util-3.17.3.jar:$APP_HOME/lib/auto-value-annotations-1.8.2.jar:$APP_HOME/lib/proto-google-cloud-language-v1-2.0.2.jar:$APP_HOME/lib/proto-google-cloud-language-v1beta2-0.87.2.jar:$APP_HOME/lib/google-auth-library-credentials-1.1.0.jar:$APP_HOME/lib/google-auth-library-oauth2-http-1.1.0.jar:$APP_HOME/lib/guava-30.1.1-jre.jar:$APP_HOME/lib/google-http-client-1.39.2.jar:$APP_HOME/lib/google-http-client-gson-1.39.2.jar:$APP_HOME/lib/grpc-alts-1.40.0.jar:$APP_HOME/lib/grpc-api-1.40.0.jar:$APP_HOME/lib/grpc-auth-1.40.0.jar:$APP_HOME/lib/grpc-context-1.40.0.jar:$APP_HOME/lib/grpc-core-1.40.0.jar:$APP_HOME/lib/grpc-grpclb-1.40.0.jar:$APP_HOME/lib/grpc-netty-shaded-1.40.0.jar:$APP_HOME/lib/grpc-protobuf-1.40.0.jar:$APP_HOME/lib/grpc-protobuf-lite-1.40.0.jar:$APP_HOME/lib/grpc-stub-1.40.0.jar:$APP_HOME/lib/api-common-2.0.1.jar:$APP_HOME/lib/gax-2.3.0.jar:$APP_HOME/lib/gax-grpc-2.3.0.jar:$APP_HOME/lib/proto-google-common-protos-2.3.2.jar:$APP_HOME/lib/trove4j-3.0.3.jar:$APP_HOME/lib/jackson-databind-2.10.1.jar:$APP_HOME/lib/jsr305-3.0.2.jar:$APP_HOME/lib/annotations-16.0.1.jar:$APP_HOME/lib/slf4j-api-1.7.25.jar:$APP_HOME/lib/nv-websocket-client-2.14.jar:$APP_HOME/lib/okhttp-3.13.0.jar:$APP_HOME/lib/opus-java-1.1.0.pom:$APP_HOME/lib/commons-collections4-4.1.jar:$APP_HOME/lib/javax.annotation-api-1.3.2.jar:$APP_HOME/lib/failureaccess-1.0.1.jar:$APP_HOME/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:$APP_HOME/lib/checker-qual-3.8.0.jar:$APP_HOME/lib/error_prone_annotations-2.9.0.jar:$APP_HOME/lib/j2objc-annotations-1.3.jar:$APP_HOME/lib/httpclient-4.5.13.jar:$APP_HOME/lib/commons-logging-1.2.jar:$APP_HOME/lib/commons-codec-1.15.jar:$APP_HOME/lib/httpcore-4.4.14.jar:$APP_HOME/lib/opencensus-contrib-http-util-0.28.0.jar:$APP_HOME/lib/gson-2.8.8.jar:$APP_HOME/lib/opencensus-api-0.28.0.jar:$APP_HOME/lib/perfmark-api-0.23.0.jar:$APP_HOME/lib/annotations-4.1.1.4.jar:$APP_HOME/lib/animal-sniffer-annotations-1.20.jar:$APP_HOME/lib/conscrypt-openjdk-uber-2.5.1.jar:$APP_HOME/lib/threetenbp-1.5.1.jar:$APP_HOME/lib/jackson-annotations-2.10.1.jar:$APP_HOME/lib/jackson-core-2.10.1.jar:$APP_HOME/lib/okio-1.17.2.jar:$APP_HOME/lib/opus-java-api-1.1.0.jar:$APP_HOME/lib/opus-java-natives-1.1.0.jar:$APP_HOME/lib/jna-4.4.0.jar
CLASSPATH=$APP_HOME/lib/Flames-5.0.1.jar:$APP_HOME/lib/JDA-4.3.0_277.jar:$APP_HOME/lib/google-cloud-language-2.0.2.jar:$APP_HOME/lib/bugsnag-3.6.2.jar:$APP_HOME/lib/protobuf-java-3.17.3.jar:$APP_HOME/lib/protobuf-java-util-3.17.3.jar:$APP_HOME/lib/auto-value-annotations-1.8.2.jar:$APP_HOME/lib/proto-google-cloud-language-v1-2.0.2.jar:$APP_HOME/lib/proto-google-cloud-language-v1beta2-0.87.2.jar:$APP_HOME/lib/google-auth-library-credentials-1.1.0.jar:$APP_HOME/lib/google-auth-library-oauth2-http-1.1.0.jar:$APP_HOME/lib/guava-30.1.1-jre.jar:$APP_HOME/lib/google-http-client-1.39.2.jar:$APP_HOME/lib/google-http-client-gson-1.39.2.jar:$APP_HOME/lib/grpc-alts-1.40.0.jar:$APP_HOME/lib/grpc-api-1.40.0.jar:$APP_HOME/lib/grpc-auth-1.40.0.jar:$APP_HOME/lib/grpc-context-1.40.0.jar:$APP_HOME/lib/grpc-core-1.40.0.jar:$APP_HOME/lib/grpc-grpclb-1.40.0.jar:$APP_HOME/lib/grpc-netty-shaded-1.40.0.jar:$APP_HOME/lib/grpc-protobuf-1.40.0.jar:$APP_HOME/lib/grpc-protobuf-lite-1.40.0.jar:$APP_HOME/lib/grpc-stub-1.40.0.jar:$APP_HOME/lib/api-common-2.0.1.jar:$APP_HOME/lib/gax-2.3.0.jar:$APP_HOME/lib/gax-grpc-2.3.0.jar:$APP_HOME/lib/proto-google-common-protos-2.3.2.jar:$APP_HOME/lib/trove4j-3.0.3.jar:$APP_HOME/lib/jackson-databind-2.10.1.jar:$APP_HOME/lib/jsr305-3.0.2.jar:$APP_HOME/lib/annotations-16.0.1.jar:$APP_HOME/lib/slf4j-api-1.7.25.jar:$APP_HOME/lib/nv-websocket-client-2.14.jar:$APP_HOME/lib/okhttp-3.13.0.jar:$APP_HOME/lib/opus-java-1.1.0.pom:$APP_HOME/lib/commons-collections4-4.1.jar:$APP_HOME/lib/javax.annotation-api-1.3.2.jar:$APP_HOME/lib/failureaccess-1.0.1.jar:$APP_HOME/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:$APP_HOME/lib/checker-qual-3.8.0.jar:$APP_HOME/lib/error_prone_annotations-2.9.0.jar:$APP_HOME/lib/j2objc-annotations-1.3.jar:$APP_HOME/lib/httpclient-4.5.13.jar:$APP_HOME/lib/commons-logging-1.2.jar:$APP_HOME/lib/commons-codec-1.15.jar:$APP_HOME/lib/httpcore-4.4.14.jar:$APP_HOME/lib/opencensus-contrib-http-util-0.28.0.jar:$APP_HOME/lib/gson-2.8.8.jar:$APP_HOME/lib/opencensus-api-0.28.0.jar:$APP_HOME/lib/perfmark-api-0.23.0.jar:$APP_HOME/lib/annotations-4.1.1.4.jar:$APP_HOME/lib/animal-sniffer-annotations-1.20.jar:$APP_HOME/lib/conscrypt-openjdk-uber-2.5.1.jar:$APP_HOME/lib/threetenbp-1.5.1.jar:$APP_HOME/lib/jackson-annotations-2.10.1.jar:$APP_HOME/lib/jackson-core-2.10.1.jar:$APP_HOME/lib/okio-1.17.2.jar:$APP_HOME/lib/opus-java-api-1.1.0.jar:$APP_HOME/lib/opus-java-natives-1.1.0.jar:$APP_HOME/lib/jna-4.4.0.jar


# Determine the Java command to use to start the JVM.
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/Flames.bat
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\lib\Flames-5.0-beta-2.jar;%APP_HOME%\lib\JDA-4.3.0_277.jar;%APP_HOME%\lib\google-cloud-language-2.0.2.jar;%APP_HOME%\lib\bugsnag-3.6.2.jar;%APP_HOME%\lib\protobuf-java-3.17.3.jar;%APP_HOME%\lib\protobuf-java-util-3.17.3.jar;%APP_HOME%\lib\auto-value-annotations-1.8.2.jar;%APP_HOME%\lib\proto-google-cloud-language-v1-2.0.2.jar;%APP_HOME%\lib\proto-google-cloud-language-v1beta2-0.87.2.jar;%APP_HOME%\lib\google-auth-library-credentials-1.1.0.jar;%APP_HOME%\lib\google-auth-library-oauth2-http-1.1.0.jar;%APP_HOME%\lib\guava-30.1.1-jre.jar;%APP_HOME%\lib\google-http-client-1.39.2.jar;%APP_HOME%\lib\google-http-client-gson-1.39.2.jar;%APP_HOME%\lib\grpc-alts-1.40.0.jar;%APP_HOME%\lib\grpc-api-1.40.0.jar;%APP_HOME%\lib\grpc-auth-1.40.0.jar;%APP_HOME%\lib\grpc-context-1.40.0.jar;%APP_HOME%\lib\grpc-core-1.40.0.jar;%APP_HOME%\lib\grpc-grpclb-1.40.0.jar;%APP_HOME%\lib\grpc-netty-shaded-1.40.0.jar;%APP_HOME%\lib\grpc-protobuf-1.40.0.jar;%APP_HOME%\lib\grpc-protobuf-lite-1.40.0.jar;%APP_HOME%\lib\grpc-stub-1.40.0.jar;%APP_HOME%\lib\api-common-2.0.1.jar;%APP_HOME%\lib\gax-2.3.0.jar;%APP_HOME%\lib\gax-grpc-2.3.0.jar;%APP_HOME%\lib\proto-google-common-protos-2.3.2.jar;%APP_HOME%\lib\trove4j-3.0.3.jar;%APP_HOME%\lib\jackson-databind-2.10.1.jar;%APP_HOME%\lib\jsr305-3.0.2.jar;%APP_HOME%\lib\annotations-16.0.1.jar;%APP_HOME%\lib\slf4j-api-1.7.25.jar;%APP_HOME%\lib\nv-websocket-client-2.14.jar;%APP_HOME%\lib\okhttp-3.13.0.jar;%APP_HOME%\lib\opus-java-1.1.0.pom;%APP_HOME%\lib\commons-collections4-4.1.jar;%APP_HOME%\lib\javax.annotation-api-1.3.2.jar;%APP_HOME%\lib\failureaccess-1.0.1.jar;%APP_HOME%\lib\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;%APP_HOME%\lib\checker-qual-3.8.0.jar;%APP_HOME%\lib\error_prone_annotations-2.9.0.jar;%APP_HOME%\lib\j2objc-annotations-1.3.jar;%APP_HOME%\lib\httpclient-4.5.13.jar;%APP_HOME%\lib\commons-logging-1.2.jar;%APP_HOME%\lib\commons-codec-1.15.jar;%APP_HOME%\lib\httpcore-4.4.14.jar;%APP_HOME%\lib\opencensus-contrib-http-util-0.28.0.jar;%APP_HOME%\lib\gson-2.8.8.jar;%APP_HOME%\lib\opencensus-api-0.28.0.jar;%APP_HOME%\lib\perfmark-api-0.23.0.jar;%APP_HOME%\lib\annotations-4.1.1.4.jar;%APP_HOME%\lib\animal-sniffer-annotations-1.20.jar;%APP_HOME%\lib\conscrypt-openjdk-uber-2.5.1.jar;%APP_HOME%\lib\threetenbp-1.5.1.jar;%APP_HOME%\lib\jackson-annotations-2.10.1.jar;%APP_HOME%\lib\jackson-core-2.10.1.jar;%APP_HOME%\lib\okio-1.17.2.jar;%APP_HOME%\lib\opus-java-api-1.1.0.jar;%APP_HOME%\lib\opus-java-natives-1.1.0.jar;%APP_HOME%\lib\jna-4.4.0.jar
set CLASSPATH=%APP_HOME%\lib\Flames-5.0.1.jar;%APP_HOME%\lib\JDA-4.3.0_277.jar;%APP_HOME%\lib\google-cloud-language-2.0.2.jar;%APP_HOME%\lib\bugsnag-3.6.2.jar;%APP_HOME%\lib\protobuf-java-3.17.3.jar;%APP_HOME%\lib\protobuf-java-util-3.17.3.jar;%APP_HOME%\lib\auto-value-annotations-1.8.2.jar;%APP_HOME%\lib\proto-google-cloud-language-v1-2.0.2.jar;%APP_HOME%\lib\proto-google-cloud-language-v1beta2-0.87.2.jar;%APP_HOME%\lib\google-auth-library-credentials-1.1.0.jar;%APP_HOME%\lib\google-auth-library-oauth2-http-1.1.0.jar;%APP_HOME%\lib\guava-30.1.1-jre.jar;%APP_HOME%\lib\google-http-client-1.39.2.jar;%APP_HOME%\lib\google-http-client-gson-1.39.2.jar;%APP_HOME%\lib\grpc-alts-1.40.0.jar;%APP_HOME%\lib\grpc-api-1.40.0.jar;%APP_HOME%\lib\grpc-auth-1.40.0.jar;%APP_HOME%\lib\grpc-context-1.40.0.jar;%APP_HOME%\lib\grpc-core-1.40.0.jar;%APP_HOME%\lib\grpc-grpclb-1.40.0.jar;%APP_HOME%\lib\grpc-netty-shaded-1.40.0.jar;%APP_HOME%\lib\grpc-protobuf-1.40.0.jar;%APP_HOME%\lib\grpc-protobuf-lite-1.40.0.jar;%APP_HOME%\lib\grpc-stub-1.40.0.jar;%APP_HOME%\lib\api-common-2.0.1.jar;%APP_HOME%\lib\gax-2.3.0.jar;%APP_HOME%\lib\gax-grpc-2.3.0.jar;%APP_HOME%\lib\proto-google-common-protos-2.3.2.jar;%APP_HOME%\lib\trove4j-3.0.3.jar;%APP_HOME%\lib\jackson-databind-2.10.1.jar;%APP_HOME%\lib\jsr305-3.0.2.jar;%APP_HOME%\lib\annotations-16.0.1.jar;%APP_HOME%\lib\slf4j-api-1.7.25.jar;%APP_HOME%\lib\nv-websocket-client-2.14.jar;%APP_HOME%\lib\okhttp-3.13.0.jar;%APP_HOME%\lib\opus-java-1.1.0.pom;%APP_HOME%\lib\commons-collections4-4.1.jar;%APP_HOME%\lib\javax.annotation-api-1.3.2.jar;%APP_HOME%\lib\failureaccess-1.0.1.jar;%APP_HOME%\lib\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;%APP_HOME%\lib\checker-qual-3.8.0.jar;%APP_HOME%\lib\error_prone_annotations-2.9.0.jar;%APP_HOME%\lib\j2objc-annotations-1.3.jar;%APP_HOME%\lib\httpclient-4.5.13.jar;%APP_HOME%\lib\commons-logging-1.2.jar;%APP_HOME%\lib\commons-codec-1.15.jar;%APP_HOME%\lib\httpcore-4.4.14.jar;%APP_HOME%\lib\opencensus-contrib-http-util-0.28.0.jar;%APP_HOME%\lib\gson-2.8.8.jar;%APP_HOME%\lib\opencensus-api-0.28.0.jar;%APP_HOME%\lib\perfmark-api-0.23.0.jar;%APP_HOME%\lib\annotations-4.1.1.4.jar;%APP_HOME%\lib\animal-sniffer-annotations-1.20.jar;%APP_HOME%\lib\conscrypt-openjdk-uber-2.5.1.jar;%APP_HOME%\lib\threetenbp-1.5.1.jar;%APP_HOME%\lib\jackson-annotations-2.10.1.jar;%APP_HOME%\lib\jackson-core-2.10.1.jar;%APP_HOME%\lib\okio-1.17.2.jar;%APP_HOME%\lib\opus-java-api-1.1.0.jar;%APP_HOME%\lib\opus-java-natives-1.1.0.jar;%APP_HOME%\lib\jna-4.4.0.jar


@rem Execute Flames
Expand Down
2 changes: 1 addition & 1 deletion build/scriptsShadow/Flames
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ case "`uname`" in
;;
esac

CLASSPATH=$APP_HOME/lib/Flames-5.0-beta-2-all.jar
CLASSPATH=$APP_HOME/lib/Flames-5.0.1-all.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
Expand Down
2 changes: 1 addition & 1 deletion build/scriptsShadow/Flames.bat
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\lib\Flames-5.0-beta-2-all.jar
set CLASSPATH=%APP_HOME%\lib\Flames-5.0.1-all.jar

@rem Execute Flames
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %FLAMES_OPTS% -jar "%CLASSPATH%" %CMD_LINE_ARGS%
Expand Down
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions src/main/java/com/severalcircles/flames/Flames.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.severalcircles.flames.frontend.thanks.ThanksCommand;
import com.severalcircles.flames.frontend.today.ResetTodayRunnable;
import com.severalcircles.flames.frontend.today.TodayCommand;
import com.severalcircles.flames.util.RankUpdateRunnable;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.interactions.commands.OptionType;
Expand Down Expand Up @@ -100,6 +101,7 @@ public static void main(String[] args) throws IOException {
GlobalData.read();
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new ReconnectRunnable(), 1, 1, TimeUnit.HOURS);
scheduler.scheduleAtFixedRate(new RankUpdateRunnable(), 0, 1, TimeUnit.HOURS);
// scheduler.scheduleAtFixedRate(new FlushHistoricalData(), 1, 1, TimeUnit.HOURS);
scheduler.scheduleAtFixedRate(new ResetTodayRunnable(), initalDelay, TimeUnit.DAYS.toSeconds(1), TimeUnit.SECONDS);
// --- Connecting to the API and Logging in to Discord ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static boolean newUser(User user) throws IOException {
public static void save(FlamesUser flamesUser) throws IOException {
String discordId = flamesUser.getDiscordId();
String name;
try {name = Objects.requireNonNull(Flames.api.getUserById(discordId)).getName(); } catch (NullPointerException e) {name = "An Unknown Flames User";}
try {name = Flames.api.getUserById(discordId).getName(); } catch (NullPointerException | IllegalArgumentException e) {name = "An Unknown Flames User";}
// OutputStream outputStream;
File udir = new File(userDirectory.getAbsolutePath() + "/" + discordId);
File user = new File(udir.getAbsolutePath() + "/user.fl");
Expand Down Expand Up @@ -129,7 +129,6 @@ public static FlamesUser readUser(User user) throws IOException, ConsentExceptio
UserStats stats = new UserStats();
UserFunFacts funFacts = new UserFunFacts();
UserConfig config = new UserConfig();
if (new FlamesDataUpdater(fluser).run()) throw new ConsentException(1, user);
if (newUser(user)) {
throw new ConsentException(0, user);
}
Expand Down Expand Up @@ -171,6 +170,9 @@ public static FlamesUser readUser(User user) throws IOException, ConsentExceptio
funFacts.setHighestEmotion(Float.parseFloat(funfactsdata.get("highestEmotion")+ ""));
funFacts.setLowestEmotion(Float.parseFloat(funfactsdata.get("lowestEmotion") + ""));
if (config.getLocale() == null) config.setLocale(Locale.getDefault());
if (new File(udir.getAbsolutePath() + "/" + FlamesUser.latestVersion + ".flamesfile").createNewFile()) {
new FlamesDataUpdater(fluser).run();
}
stats = new UserStats(Integer.parseInt(statsdata.get("exp") + ""), Integer.parseInt(statsdata.get("level") + ""), Integer.parseInt(statsdata.get("POW") + ""), Integer.parseInt(statsdata.get("RES") + ""), Integer.parseInt(statsdata.get("LUCK") + ""), Integer.parseInt(statsdata.get("RISE") + ""), Integer.parseInt(statsdata.get("CAR") + ""));
config = new UserConfig(Locale.forLanguageTag(configdata.get("locale") + ""));
fluser.setStats(stats);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
import com.severalcircles.flames.data.user.UserConfig;
import com.severalcircles.flames.data.user.UserFunFacts;
import com.severalcircles.flames.data.user.UserStats;
//import sun.util.logging.PlatformLogger;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class FlamesDataUpdater {
public static final double minimumVersion = 2.0;
Expand All @@ -26,17 +29,14 @@ public FlamesDataUpdater(FlamesUser flamesUser) {
public boolean run() throws DataVersionException, IOException {
if (flamesUser.getDataVersion() < minimumVersion) throw new DataVersionException(true);
if (flamesUser.getDataVersion() > FlamesUser.latestVersion) throw new DataVersionException(false);
if (flamesUser.getDataVersion() == FlamesUser.latestVersion) return false;
if (flamesUser.getDataVersion() == 2.0) {
stats.setLevel((int) Math.round(Math.log(stats.getExp()) / Math.log(2)));
stats.setLevel((int) Math.round(Math.log(stats.getExp()) / Math.log(2)) + 1);
stats.setCAR((int) Math.round(Math.random() * stats.getLevel()));
stats.setLUCK((int) Math.round(Math.random() * stats.getLevel()));
stats.setRISE((int) Math.round(Math.random() * stats.getLevel()));
stats.setPOW((int) Math.round(Math.random() * stats.getLevel()));
stats.setRES((int) Math.round(Math.random() * stats.getLevel()));
if (flamesUser.getScore() >= 100000) flamesUser.setScore(flamesUser.getScore() / 2);
flamesUser.setDataVersion(2.1);
}
flamesUser.setStats(stats);
FlamesDataManager.save(flamesUser);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class FlamesUser implements FlamesData {
private UserStats stats;
private int consent;
private UserFunFacts funFacts;
private double dataVersion = 2.1;
private double dataVersion;

public double getDataVersion() {
return dataVersion;
Expand Down Expand Up @@ -106,6 +106,7 @@ public FlamesUser() {
this.consent = 0;
this.funFacts = new UserFunFacts();
this.config = new UserConfig();
this.dataVersion = 2.1;
}

public void addScore(int amount) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public MessageEmbed get() {
.addField(resources.getString("bonus"), StringUtil.formatScore(2500), true)
.setImage(resources.getString("image"))
.setColor(Color.yellow)
.setFooter(String.format(resources.getString("footer"), sender.getName()), thanked.getAvatarUrl())
.setFooter(String.format(resources.getString("footer"), thanked.getName()), thanked.getAvatarUrl())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2021 Several Circles.
*/

package com.severalcircles.flames.util;

import java.io.IOException;

public class RankUpdateRunnable implements Runnable{
@Override
public void run() {
try {
Ranking.updateThresholds();
} catch (IOException e) {
e.printStackTrace();
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/severalcircles/flames/util/Ranking.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void updateThresholds() throws IOException {
*/
public static Rank getRank(int score) {
// what a glorious function
if (thresholds[0] <= 0) return Rank.UNRANKED;
if (thresholds[0] < 0) return Rank.UNRANKED;
if (score < thresholds[0]) return Rank.UNRANKED;
else if (score < thresholds[1]) return Rank.APPROACHING_BRONZE;
else if (score < thresholds[2]) return Rank.BRONZE;
Expand Down

0 comments on commit 7b903bd

Please sign in to comment.