Skip to content

Commit

Permalink
ASMAPI.getSystemPropertyFlag() checks the given property without only…
Browse files Browse the repository at this point in the history
… prepending "coremod." (#45)
  • Loading branch information
Jonathing authored Nov 13, 2023
1 parent 7628272 commit 7f46b51
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/net/minecraftforge/coremod/api/ASMAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ private static String map(String name, INameMappingService.Domain domain) {
map(f -> f.apply(domain, name)).orElse(name);
}

/**
* Checks if the given JVM property (or if the property prepended with {@code "coremod."}) is {@code true}.
*
* @param propertyName the property to check
* @return true if the property is true
*/
public static boolean getSystemPropertyFlag(final String propertyName) {
return Boolean.getBoolean("coremod." + propertyName) || getSystemPropertyFlagOld(propertyName);
}

/** @deprecated Contains the old, bugged logic that {@link #getSystemPropertyFlag(String)} used to have. */
@Deprecated(forRemoval = true, since = "5.0")
private static boolean getSystemPropertyFlagOld(final String propertyName) {
return Boolean.getBoolean(System.getProperty("coremod." + propertyName, "TRUE"));
return Boolean.getBoolean(propertyName) || Boolean.getBoolean("coremod." + propertyName);
}

public enum InsertMode {
Expand Down

0 comments on commit 7f46b51

Please sign in to comment.