Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Company Generator: Prevent Preset From Loading in Older Versions #3582

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1031,11 +1031,18 @@ public static CompanyGenerationOptions parseFromXML(final @Nullable File file) {

/**
* @param nl the node list to parse the options from
* @param ignoredVersion the Version of the XML to parse from. This is included for future-proofing
* @param version the Version of the XML to parse from
* @return the parsed company generation options, or null if the parsing fails
*/
public static @Nullable CompanyGenerationOptions parseFromXML(final NodeList nl,
final Version ignoredVersion) {
final Version version) {
if (MHQConstants.VERSION.isLowerThan(version)) {
LogManager.getLogger().error(String.format(
"Cannot parse Company Generation Options from %s in older version %s.",
version.toString(), MHQConstants.VERSION));
return null;
}

final CompanyGenerationOptions options = new CompanyGenerationOptions(CompanyGenerationMethod.WINDCHILD);
try {
for (int x = 0; x < nl.getLength(); x++) {
Expand Down