Updated version number in plugin.yml, and made API #getVersion read the value from the plugin description and return the major version number only

This commit is contained in:
Artemis-the-gr8 2023-02-23 13:49:23 +01:00
parent 4a67dfef10
commit 18ac4ecf00
4 changed files with 9 additions and 10 deletions

View File

@ -4,7 +4,7 @@
<groupId>io.github.ithotl</groupId>
<artifactId>PlayerStats</artifactId>
<name>PlayerStats</name>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
<description>Statistics Plugin</description>
<url>https://www.spigotmc.org/resources/playerstats.102347/</url>
<developers>

View File

@ -6,7 +6,7 @@
<groupId>io.github.ithotl</groupId>
<artifactId>PlayerStats</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
<name>PlayerStats</name>
<description>Statistics Plugin</description>

View File

@ -29,13 +29,13 @@ public interface PlayerStats {
}
/**
* Gets the current version of PlayerStatsAPI.
* Use this method to ensure the correct version of
* PlayerStats is running on the server before
* accessing further API methods, to prevent
* <code>ClassDefNotFoundExceptions</code>.
* Gets the version number of the PlayerStats API
* that's present for this instance of PlayerStats.
* This number equals the major version number
* of PlayerStats. For v1.7.2, for example,
* the API version will be 1.
*
* @return the version of PlayerStatsAPI present on the server
* @return the API version number
*/
String getVersion();

View File

@ -166,10 +166,9 @@ public final class Main extends JavaPlugin implements PlayerStats {
}.runTaskLaterAsynchronously(this, 200);
}
@Contract(pure = true)
@Override
public @NotNull String getVersion() {
return "1.8";
return String.valueOf(this.getDescription().getVersion().charAt(0));
}
@Override