use of me.deecaad.weaponmechanics.weapon.trigger.Trigger in project MechanicsMain by WeaponMechanics.
the class ScopeHandler method validate.
@Override
public void validate(Configuration configuration, File file, ConfigurationSection configurationSection, String path) {
Trigger trigger = configuration.getObject(path + ".Trigger", Trigger.class);
if (trigger == null) {
debug.log(LogLevel.ERROR, "Tried to use scope without defining trigger for it.", "Located at file " + file + " in " + path + ".Trigger in configurations.");
}
int zoomAmount = configuration.getInt(path + ".Zoom_Amount");
if (zoomAmount < 1 || zoomAmount > 32) {
debug.log(LogLevel.ERROR, "Tried to use scope without defining proper zoom amount for it, or it was missing.", "Zoom amount has to be between 1 and 32.", "Located at file " + file + " in " + path + ".Zoom_Amount in configurations.");
}
int maximumStacks = configuration.getInt(path + ".Zoom_Stacking.Maximum_Stacks");
int increaseZoomPerStack = configuration.getInt(path + ".Zoom_Stacking.Increase_Zoom_Per_Stack");
int finalValue = maximumStacks * increaseZoomPerStack + zoomAmount;
if (finalValue > 32 || finalValue < 1) {
debug.log(LogLevel.ERROR, "Final value of zoom stacking cannot go above 32 or below 1.", "Currently potential final value is " + finalValue + ", make sure its between 1 and 32.", "Located at file " + file + " in " + path + ".Zoom_Stacking in configurations.");
}
int shootDelayAfterScope = configuration.getInt(path + ".Shoot_Delay_After_Scope");
if (shootDelayAfterScope != 0) {
// Convert to millis
configuration.set(path + ".Shoot_Delay_After_Scope", shootDelayAfterScope * 50);
}
}
Aggregations