use of org.spongepowered.common.applaunch.plugin.PluginPlatform in project SpongeCommon by SpongePowered.
the class MainMixin_Forge method forge$initLaunch.
@Inject(method = "<clinit>", at = @At("RETURN"))
private static void forge$initLaunch(final CallbackInfo ci) {
final PluginPlatform pluginPlatform = AppLaunch.pluginPlatform();
final ForgeLaunch launch = new ForgeLaunch(pluginPlatform);
Launch.setInstance(launch);
}
use of org.spongepowered.common.applaunch.plugin.PluginPlatform in project SpongeCommon by SpongePowered.
the class TokenHoldingString method parsePlaceholders.
/**
* Parse an environment variable-style placeholder syntax.
*
* <p>Variable names are case-insensitive, and detected with the
* {@link #TOKEN_MATCH} expression.</p>
*
* @param input input string
* @return string with placeholders replaced
*/
private static String parsePlaceholders(final String input) {
final Matcher matcher = TokenHoldingString.TOKEN_MATCH.matcher(input);
if (!matcher.find()) {
return input;
}
final StringBuffer result = new StringBuffer();
do {
final String token = matcher.group(1);
final Function<PluginPlatform, String> replacer = TokenHoldingString.TOKENS.get(token.toLowerCase());
final String replaced = replacer == null ? "" : replacer.apply(AppLaunch.pluginPlatform());
matcher.appendReplacement(result, replaced == null ? "" : TokenHoldingString.sanitizePath(replaced));
} while (matcher.find());
matcher.appendTail(result);
return result.toString();
}
use of org.spongepowered.common.applaunch.plugin.PluginPlatform in project SpongeCommon by SpongePowered.
the class MainMixin_Forge method forge$initLaunch.
@Inject(method = "<clinit>", at = @At("RETURN"))
private static void forge$initLaunch(final CallbackInfo ci) {
if (Launch.instance() != null) {
return;
}
final PluginPlatform pluginPlatform = AppLaunch.pluginPlatform();
final ForgeLaunch launch = new ForgeLaunch(pluginPlatform);
Launch.setInstance(launch);
}
Aggregations