Class ExtensionPrototype

java.lang.Object
de.geolykt.starloader.mod.ExtensionPrototype
Direct Known Subclasses:
NamedExtensionPrototype

public class ExtensionPrototype extends Object
A prototype of an extension. This class is different to the DiscoveredExtension class as it is only used within the launcher to explain whether a jar should be loaded or not.
  • Field Details

    • enabled

      public boolean enabled
    • originURLs

      public final List<URL> originURLs
  • Constructor Details

    • ExtensionPrototype

      @Deprecated @ScheduledForRemoval(inVersion="5.0.0") public ExtensionPrototype(List<URL> originURLs)
      Deprecated.
    • ExtensionPrototype

      @Deprecated @ScheduledForRemoval(inVersion="5.0.0") public ExtensionPrototype(List<URL> originURLs, boolean enabled)
      Deprecated.
    • ExtensionPrototype

      @AvailableSince("4.0.0-a20240711") @Contract(pure=true) public ExtensionPrototype(List<URL> originURLs, boolean enabled, @Nullable @Nullable Map<String,String> properties)
  • Method Details

    • getDefinedProperties

      @Nullable @AvailableSince("4.0.0-a20240711") @Contract(pure=true) public @Nullable @UnmodifiableView Map<String,String> getDefinedProperties()
      Obtains the placeholder properties applicable to this extension prototype. When parsing the extension.json file of the mod backed by this ExtensionPrototype, placeholders are expanded using the key-value pairs supplied by this method. If this method returns null, this step shall not be performed.

      Placeholders have the pattern of '${propertyKey}'. When found, the placeholder will be replaced with the corresponding value declared by the map returned by this method. If no value is present in the returned map, then the placeholder is skipped and a warning may get logged hinting at the absence of the key.

      This process is required as not doing so would mean that when using these placeholders in the extension.json files of mods will not get applied when launching from the IDE, which can result in crashes during the dependency resolution process.

      Warning: When launching the mod outside the IDE, this feature is not present as it will only be set by the IDELauncher.

      Returns:
      A map mapping the placeholder keys to their respective values, or null if the process should be skipped.
      Since:
      4.0.0-a20240711
    • toString

      public String toString()
      Overrides:
      toString in class Object