});
}
- /** The version. */
- private static final Version VERSION = new Version(0, 9, 6);
-
/** The current year at time of release. */
private static final int YEAR = 2016;
private static final String SONE_HOMEPAGE = "USK@nwa8lHa271k2QvJ8aa0Ov7IHAV-DFOCFgmDt3X6BpCI,DuQSUZiI~agF8c-6tjsFFGuZ8eICrzWCILB60nT8KKo,AQACAAE/sone/";
}
public static String getPluginVersion() {
- return VERSION.toString();
+ net.pterodactylus.sone.main.Version version = VersionParserKt.parseVersion();
+ return (version == null) ? "unknown" : version.getNice();
}
public static int getYear() {
bind(Context.class).toInstance(context);
bind(getOptionalContextTypeLiteral()).toInstance(of(context));
bind(SonePlugin.class).toInstance(SonePlugin.this);
- bind(Version.class).toInstance(VERSION);
+ bind(Version.class).toInstance(Version.parse(getVersion()));
bind(PluginVersion.class).toInstance(new PluginVersion(getVersion()));
bind(PluginYear.class).toInstance(new PluginYear(getYear()));
bind(PluginHomepage.class).toInstance(new PluginHomepage(getHomepage()));
*/
@Override
public String getVersion() {
- return VERSION.toString();
+ return getPluginVersion();
}
public static class PluginVersion {
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
+@JvmOverloads
fun parseVersion(file: String = "/version.yaml"): Version? =
Version::class.java.getResourceAsStream(file)?.use {
objectMapper.readValue(it, Version::class.java)