Some config changes

This commit is contained in:
TomTom 2024-08-02 17:11:27 +02:00
parent f166066c00
commit 21555772d0
2 changed files with 22 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import com.artillexstudios.axapi.utils.YamlUtils;
import com.artillexstudios.axminions.AxMinionsPlugin; import com.artillexstudios.axminions.AxMinionsPlugin;
import com.artillexstudios.axminions.database.DatabaseType; import com.artillexstudios.axminions.database.DatabaseType;
import com.artillexstudios.axminions.utils.FileUtils; import com.artillexstudios.axminions.utils.FileUtils;
import com.artillexstudios.axminions.utils.LogUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -27,6 +28,7 @@ public final class Config {
public static int DATABASE_KEEPALIVE_TIME = 0; public static int DATABASE_KEEPALIVE_TIME = 0;
public static int DATABASE_CONNECTION_TIMEOUT = 5000; public static int DATABASE_CONNECTION_TIMEOUT = 5000;
public static DatabaseType DATABASE_TYPE = DatabaseType.H2; public static DatabaseType DATABASE_TYPE = DatabaseType.H2;
public static int AUTOSAVE_SECONDS = 300;
public static int TICK_FREQUENCY = 1; public static int TICK_FREQUENCY = 1;
public static boolean SHOW_HAND_ANIMATION = true; public static boolean SHOW_HAND_ANIMATION = true;
public static boolean ASYNC_HAND_ANIMATION = false; public static boolean ASYNC_HAND_ANIMATION = false;
@ -78,6 +80,7 @@ public final class Config {
DATABASE_MAXIMUM_LIFETIME = config.getInt("database.pool.maximum-lifetime", DATABASE_MAXIMUM_LIFETIME); DATABASE_MAXIMUM_LIFETIME = config.getInt("database.pool.maximum-lifetime", DATABASE_MAXIMUM_LIFETIME);
DATABASE_KEEPALIVE_TIME = config.getInt("database.pool.keepalive-time", DATABASE_KEEPALIVE_TIME); DATABASE_KEEPALIVE_TIME = config.getInt("database.pool.keepalive-time", DATABASE_KEEPALIVE_TIME);
DATABASE_CONNECTION_TIMEOUT = config.getInt("database.pool.connection-timeout", DATABASE_CONNECTION_TIMEOUT); DATABASE_CONNECTION_TIMEOUT = config.getInt("database.pool.connection-timeout", DATABASE_CONNECTION_TIMEOUT);
AUTOSAVE_SECONDS = config.getInt("autosave-seconds", AUTOSAVE_SECONDS);
TICK_FREQUENCY = config.getInt("tick-frequency", TICK_FREQUENCY); TICK_FREQUENCY = config.getInt("tick-frequency", TICK_FREQUENCY);
SHOW_HAND_ANIMATION = config.getBoolean("show-hand-animation", SHOW_HAND_ANIMATION); SHOW_HAND_ANIMATION = config.getBoolean("show-hand-animation", SHOW_HAND_ANIMATION);
ASYNC_HAND_ANIMATION = config.getBoolean("async-hand-animation", ASYNC_HAND_ANIMATION); ASYNC_HAND_ANIMATION = config.getBoolean("async-hand-animation", ASYNC_HAND_ANIMATION);
@ -87,5 +90,18 @@ public final class Config {
LANGUAGE = config.getString("language", LANGUAGE); LANGUAGE = config.getString("language", LANGUAGE);
USE_BSTATS = config.getBoolean("use-bstats", USE_BSTATS); USE_BSTATS = config.getBoolean("use-bstats", USE_BSTATS);
DEBUG = config.getBoolean("debug", DEBUG); DEBUG = config.getBoolean("debug", DEBUG);
this.validate();
}
private void validate() {
if (Config.AUTOSAVE_SECONDS <= 30) {
LogUtils.warn("It is not recommended to set autosave-seconds to 30, as this might degrade performance!");
}
if (Config.DATABASE_MAXIMUM_POOL_SIZE < 1) {
LogUtils.warn("Maximum database pool size is lower than 1! This is not supported! Defaulting to 1.");
DATABASE_MAXIMUM_POOL_SIZE = 1;
}
} }
} }

View File

@ -12,6 +12,12 @@ database:
keepalive-time: 0 keepalive-time: 0
connection-timeout: 5000 connection-timeout: 5000
# How often should changes to minions get saved?
# This saves rotation, tool, statistics, etc.
# Minions are automatically saved when placed.
# This also doesn't affect minion removal saving.
autosave-seconds: 300
# How often should we tick minions? # How often should we tick minions?
# Increasing this might improve performance a bit. # Increasing this might improve performance a bit.
# If this is increased, minion animations might look a bit choppy. # If this is increased, minion animations might look a bit choppy.