Class SettingsManager
This class provides methods to load the configuration file and retrieve values for various settings such as required playtime, AFK threshold, and weekend multipliers, with the weekend multiplier being shared across all players.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
getAfkThresholdSeconds
(UUID playerUuid) Retrieves the AFK threshold in seconds for a specific player.static double
Retrieves the base multiplier for all players.static int
getRequiredMinutes
(UUID playerUuid) Retrieves the required playtime for a specific player.static double
Retrieves the social distance for all players.static double
Retrieves the social multiplier for all players.static double
Retrieves the global weekend multiplier for all players.static void
load
(org.bukkit.plugin.java.JavaPlugin pl) Loads the plugin's configuration file.static void
reload
(org.bukkit.plugin.java.JavaPlugin plugin) Reloads the plugin's configuration file.
-
Constructor Details
-
SettingsManager
public SettingsManager()
-
-
Method Details
-
load
public static void load(org.bukkit.plugin.java.JavaPlugin pl) Loads the plugin's configuration file.This method initializes the configuration by getting the config from the provided JavaPlugin instance. This must be called before accessing any configuration values.
- Parameters:
pl
- The plugin instance from which the configuration is loaded.
-
reload
public static void reload(org.bukkit.plugin.java.JavaPlugin plugin) Reloads the plugin's configuration file.This method reloads the configuration by getting the config from the provided JavaPlugin instance. This must be called to refresh the configuration values.
- Parameters:
plugin
- The plugin instance from which the configuration is reloaded.
-
getRequiredMinutes
Retrieves the required playtime for a specific player.This method fetches the "required_minutes" setting from the configuration file. If the setting is not found, the default value of 60 minutes is returned.
- Parameters:
playerUuid
- The UUID of the player whose required playtime is being retrieved.- Returns:
- The required playtime in minutes for the specific player.
-
getAfkThresholdSeconds
Retrieves the AFK threshold in seconds for a specific player.This method fetches the "afk_threshold_seconds" setting from the configuration file. If the setting is not found, the default value of 300 seconds (5 minutes) is returned.
- Parameters:
playerUuid
- The UUID of the player whose AFK threshold is being retrieved.- Returns:
- The AFK threshold in seconds for the specific player.
-
getWeekendMultiplier
public static double getWeekendMultiplier()Retrieves the global weekend multiplier for all players.This method fetches the "weekend_multiplier" setting from the configuration file. If the setting is not found, the default value of 1.5 is returned.
- Returns:
- The global weekend playtime multiplier for all players.
-
getBaseMultiplier
public static double getBaseMultiplier()Retrieves the base multiplier for all players.This method fetches the "multipliers.base" setting from the configuration file. If the setting is not found, the default value of 1.0 is returned.
- Returns:
- The base playtime multiplier for all players.
-
getSocialMultiplier
public static double getSocialMultiplier()Retrieves the social multiplier for all players.This method fetches the "multipliers.social" setting from the configuration file. If the setting is not found, the default value of 0.0 is returned.
- Returns:
- The social playtime multiplier for all players.
-
getSocialDistance
public static double getSocialDistance()Retrieves the social distance for all players.This method fetches the "multipliers.social-distance" setting from the configuration file. If the setting is not found, the default value of 10.0 is returned.
- Returns:
- The social distance for all players.
-