Adds `SongodaCore#getVersion` and deprecate `#getCoreLibraryVersion`

This commit is contained in:
Christian Koop 2022-08-25 08:35:41 +02:00
parent 163e4d9eaf
commit b779194e3e
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
3 changed files with 8 additions and 10 deletions

View File

@ -281,6 +281,10 @@ public class SongodaCore {
return new ArrayList<>(registeredPlugins);
}
public static String getVersion() {
return SongodaCoreConstants.getCoreVersion();
}
/**
* @deprecated Use {@link #getCoreMajorVersion()} instead, but careful, coreRevision is at 9 while major version is at 2
*/
@ -289,12 +293,13 @@ public class SongodaCore {
return coreRevision;
}
@Deprecated
public static String getCoreLibraryVersion() {
return SongodaCoreConstants.getCoreVersion();
}
public static int getCoreMajorVersion() {
String fullVersion = getCoreLibraryVersion();
String fullVersion = getVersion();
if (fullVersion.contains(".")) {
return Integer.parseInt(fullVersion.substring(0, fullVersion.indexOf(".")));
}

View File

@ -211,7 +211,7 @@ public abstract class SongodaPlugin extends JavaPlugin {
"Unexpected error while loading %s v%s (core v%s): Disabling plugin!",
getDescription().getName(),
getDescription().getVersion(),
SongodaCore.getCoreLibraryVersion()
SongodaCore.getVersion()
), th);
emergencyStop();

View File

@ -75,19 +75,12 @@
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${nms.ver}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${nms.ver}</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>