mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2025-07-01 13:44:44 +02:00
Fixes a few problems
Makes sure to actually load the configuration when starting the plugin Makes sure all numeric configuration values are within expected bounds Adds improved descriptions of configuration values' bounds
This commit is contained in:
@ -111,10 +111,10 @@ public final class Dropper extends JavaPlugin {
|
||||
|
||||
// Reload configuration
|
||||
this.reloadConfig();
|
||||
configuration.load();
|
||||
this.configuration.load();
|
||||
|
||||
// Clear record caches
|
||||
dropperRecordExpansion.clearCaches();
|
||||
this.dropperRecordExpansion.clearCaches();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,6 +137,7 @@ public final class Dropper extends JavaPlugin {
|
||||
instance = this;
|
||||
this.saveDefaultConfig();
|
||||
this.configuration = new DropperConfiguration(this.getConfig());
|
||||
this.configuration.load();
|
||||
this.playerRegistry = new DropperArenaPlayerRegistry();
|
||||
this.arenaHandler = new DropperArenaHandler();
|
||||
this.arenaHandler.loadArenas();
|
||||
|
@ -170,10 +170,36 @@ public class DropperConfiguration {
|
||||
this.overrideVerticalVelocity = configuration.getBoolean("overrideVerticalVelocity", true);
|
||||
this.liquidHitBoxDepth = configuration.getDouble("liquidHitBoxDepth", -0.8);
|
||||
this.solidHitBoxDistance = configuration.getDouble("solidHitBoxDistance", 0.2);
|
||||
sanitizeValues();
|
||||
|
||||
loadBlockWhitelist();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes configuration values to ensure they are within expected bounds
|
||||
*/
|
||||
private void sanitizeValues() {
|
||||
if (this.liquidHitBoxDepth <= -1 || this.liquidHitBoxDepth > 0) {
|
||||
this.liquidHitBoxDepth = -0.8;
|
||||
}
|
||||
|
||||
if (this.solidHitBoxDistance <= 0 || this.solidHitBoxDistance > 1) {
|
||||
this.solidHitBoxDistance = 0.2;
|
||||
}
|
||||
|
||||
if (this.horizontalVelocity > 1 || this.horizontalVelocity <= 0) {
|
||||
this.horizontalVelocity = 1;
|
||||
}
|
||||
|
||||
if (this.verticalVelocity <= 0 || this.verticalVelocity > 75) {
|
||||
this.verticalVelocity = 1;
|
||||
}
|
||||
|
||||
if (this.randomlyInvertedTimer <= 0 || this.randomlyInvertedTimer > 3600) {
|
||||
this.randomlyInvertedTimer = 7;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the materials specified in the block whitelist
|
||||
*/
|
||||
|
Reference in New Issue
Block a user