From 2edd1f2295083477d401b0ce6b71d66a3aced178 Mon Sep 17 00:00:00 2001 From: sya-ri Date: Sat, 3 Apr 2021 17:27:59 +0900 Subject: [PATCH] =?UTF-8?q?api(nms):=20SERVER=5FVERSION=20=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- .../kotlin/com/github/syari/spigot/api/nms/extension.kt | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e481ca54..7608f4ee 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ repositories { } dependencies { - api('com.github.sya-ri:EasySpigotAPI:2.2.4') { + api('com.github.sya-ri:EasySpigotAPI:2.3.0') { exclude group: 'org.spigotmc', module: 'spigot-api' } } @@ -276,7 +276,7 @@ repositories { } dependencies { - api("com.github.sya-ri:EasySpigotAPI:2.2.4") { + api("com.github.sya-ri:EasySpigotAPI:2.3.0") { exclude(group = "org.spigotmc", module = "spigot-api") } } @@ -302,7 +302,7 @@ configurations { } dependencies { - shadowApi('com.github.sya-ri:EasySpigotAPI:2.2.4') { + shadowApi('com.github.sya-ri:EasySpigotAPI:2.3.0') { exclude group: 'org.spigotmc', module: 'spigot-api' } } @@ -327,7 +327,7 @@ repositories { } dependencies { - shadowApi("com.github.sya-ri:EasySpigotAPI:2.2.4") { + shadowApi("com.github.sya-ri:EasySpigotAPI:2.3.0") { exclude(group = "org.spigotmc", module = "spigot-api") } } diff --git a/api/src/main/kotlin/com/github/syari/spigot/api/nms/extension.kt b/api/src/main/kotlin/com/github/syari/spigot/api/nms/extension.kt index a6cf7699..50eec68f 100644 --- a/api/src/main/kotlin/com/github/syari/spigot/api/nms/extension.kt +++ b/api/src/main/kotlin/com/github/syari/spigot/api/nms/extension.kt @@ -8,6 +8,12 @@ import org.bukkit.Bukkit */ val NMS_VERSION = Bukkit.getServer()::class.java.`package`.name.substring(23) +/** + * サーバーのメジャーバージョン。1.16.5 であれば 16 になる。 + * @since 2.3.0 + */ +val SERVER_VERSION = NMS_VERSION.split('_')[1].toInt() + /** * NMS のクラスを取得する。`%s` が [NMS_VERSION] に置き換わる。 * ```