Skip to content

Commit a593c27

Browse files
authored
Update versions and remove plugins module (DevSrSouza#27)
* update dependency versions and remove plugins module * update versions on README.md * update to Kotlin 1.5 * use value classes instead of inline class * fix std library change * replace deprecated methods in kotlin std
1 parent da3c07c commit a593c27

File tree

30 files changed

+67
-423
lines changed

30 files changed

+67
-423
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## KotlinBukkitAPI
44

5-
![Kotlin version](https://img.shields.io/static/v1?label=Kotlin&message=1.4.0&color=Orange&style=for-the-badge)
5+
![Kotlin version](https://img.shields.io/static/v1?label=Kotlin&message=1.5.0&color=Orange&style=for-the-badge)
66
[![GitHub stars](https://img.shields.io/github/stars/DevSrSouza/KotlinBukkitAPI.svg?style=for-the-badge&color=orange&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADYklEQVR4XuWbvbPNQBiHn9uo6NFT0GEYHa0/QofOR2MojI8xxmh8VFwVf4RaxTB0KOhdPRUF8zPJmdy1J3l3N9ndxDb3zr0n2exzfu/zJjk5G5Qdh5vp35c6jI1SEzfzbgK/gXOljqMkgF3A1wbAXuBHCQglAehdf9wsWr8rDdlHSQCq+0MdBxzJvnqgFADJ752zYAHILsNSABT3Mw4A/S27DEsAaOW30wHwHcguwxIAuvJzyz67DEsA6MrPBaD/ZZVhbgA++bkQssowNwCf/FwAWWWYE8A6+bkAssowJ4A++RWTYU4AffIrJsNcACzyKyLDXAAs8isiwxwArPIrIsMcAELkl12GOQCEyC+7DAUgpj5LXLpPMeemAOwAXgLHp5ih4n2+Ak62JbCnuRmhn//D2ALUmre6DlAClAQlYsnjJ3ACeK1FuhI8CzxZ8uqbu06rG7C+LrBkKf5zpekDsFQp/pUeoBJYjXXnAUuT4kp6bnn3nQgtRYrbpBcCQK9dghR7b7RaToXnLMXB22sWAHOVold6oSXQvn5uUlwrvVgA2m4uUuyVXgqAuUgx6NMliwN8t6rcDzZrOXselF5qArR9rVI0SW8MANpHbVI0S28sADVJMUh6YwKoRYpB0hsbwEHgQ2ED6hg+xR5DTBfoznUDuB47+Ujb6Rhuxu4rFcBH4EDs5CNtp3dfKYgaKQBqiH+76OgySAFQQ/xbANFlkAKghvi3AKLLIBZATfFPKoNYADXFP6kMYgHUFP+kMogBUGP8o8sgBsBY8f8MXGqO/D6wP6qRb98ouBvEAEiNvx6DuwU8BH41x69L7AvANUBPlMSO4G4QCiAl/vpqzDPgKvBtzQp3A3eB0wmP8gedFIUCiI3/G+A88Nb41h4DHgFHja93r0/M1wahAELjr3f6CvC8+W5QyHp0bEqCEqFkWEdQGYQACIm/blI8AG4DqvmUISfIDXKE9dkFcxmEALDG/wVwEfiSsmrPtvsaqKcM+zV3gxAAQ/Fv25oATDkEYKhtmsvACqAv/r62NiUA7dvSNk1lYAXgi7+lrU0Noq9tmsrACsCNf2hbmxqEr22aysACoBv/lLY2NQRf2xwsAwsARUlnb2O1talBdNvmnaEbphYA94CnE7S1qUGobeozzMt9E/0BUX274HXoySkAAAAASUVORK5CYII=)](https://github.com/DevSrSouza/KotlinBukkitAPI/stargazers)
77
[![Github Issues](https://img.shields.io/github/issues-raw/DevSrSouza/KotlinBukkitAPI.svg?style=for-the-badge&color=orange&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAGfklEQVR4Xu2bd6glNRSHv7Vjw46KDRULCqLYFVSwIHZFFCvYKzZU7A17r6CsiqjYG4oigqIidtQ/RCzYOzbsDZUPMst9900myczc3bfuHnj/vElyzvklOTntTmIGp0kzuP7MBGDmCRg9ArMCawMbA6sCKwNLA/OFP7//BnwPfAa8C7wBvAC8BPw5ShFHdQXmALYF9gQ2B+ZvqcQvwBPAXcCDwO8t14lO6xuARYBjgEOAhXoW9jtgMnA58GVfa/cFwDzAacCRwNx9CRdZx+tyNXAu8GNXXn0AsBNwFbBUV2EK538BHA48UDhvzPAuAMwVFD+wiwA9zL05AOHJKKa2ALjbjwBrFHM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9wIauxhZhV1hKiRESjFuygzdDew2vGAMgJxiiEUQvbJS6vMVGOSdSotZPn84FwBjcBMe+v0x+iYkRb0uJTQKAFLKK+uSdSe2yae2GHlqQjPDVCO1EuobgJTyylaUEKmUcfc/AmyAaqLSq9AnAIPeYEzGn0J4rxEcR6nQMqc4YqHC3N2jmcegLwC80yZmUjmCsxtqhMnY2pY3i6OpdhiLo2ZuckDoAwDzhabuDc2bSN9/tdCJWjsudQKcJNJWYlLkSTgi42XoCsChoTstJ08oUI2bkgOAil8HyDiHNIw2TJpZ6pMs09kXYDUoh+xdtFGjkXIB8KiZDl8ztWD4rvJGalaNuzY7m52yAu1d1pPLoZdDYjfJOxcAmfqO2iS1XI4EYcynYddskirt4bNrrGqSStmgQZHeBzbK7ScuAUAmKwHmC2LNSjFs9L9tj3syBCNvh+qzT5Q2wU4UAbbeuC6wCbB+hoUf5vdV2Pn3cjepFIAKBBslS05Crjxdxrnzls+zlZdZGwCq66BfvVYXiXuc6+myTae4jb4tAMquYbwMOKxHRdospbU/vq2x7QJAJazI27+f083ZRsHYHJ0c/Y4c5yvKtw8AXFyP0Zy76WoN2ihJw+mvRuxga9UiPyhcXwBUa+qs6Hx4LXLf7FywDGl1hK7sswu1bwAqZXRetgb2ArYAFsjVcmicEZw/mroNeCz0A7Vcqn7aqAAY5GaOUQ9y8GdzOja24FR5R3/749G290gfwQBMf+O14Rxer9p3eAb7lmOarTc1TsA0Uy6H8UwAclD6P4/5D0siPlDBJvVTAAAAAElFTkSuQmCC)](https://github.com/DevSrSouza/KotlinBukkitAPI/issues)
88
[![GitHub last commit](https://img.shields.io/github/last-commit/DevSrSouza/KotlinBukkitAPI/master.svg?style=for-the-badge&color=orange&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAABACAYAAABP97SyAAADZElEQVRoQ+2ZSciOURTHf1+ZZdoZMpdhIUOyJGTe2CpLyRhKYYGwQUghQ1nJ3sZQhpIQGbKhEMk8LMg8Rf/PfdT3ed/nTs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Jggg==)](https://github.com/DevSrSouza/KotlinBukkitAPI/commit)
@@ -125,14 +125,14 @@ More about how to setup a project with KotlinBukkitAPI [here](https://github.com
125125

126126
| Name | Version |
127127
| --- | --- |
128-
| Kotlin STD + JDK8 | 1.4.10 |
129-
| Kotlin Reflect | 1.4.10 |
130-
| [Kotlinx-coroutines](https://github.com/Kotlin/kotlinx.coroutines/) | 1.3.9 |
128+
| Kotlin STD + JDK8 | 1.5.0 |
129+
| Kotlin Reflect | 1.5.0 |
130+
| [Kotlinx-coroutines](https://github.com/Kotlin/kotlinx.coroutines/) | 1.5.0-RC |
131131
| [Skedule](https://github.com/okkero/Skedule) | 1.2.6 |
132-
| [Kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) | 1.4.0-RC |
133-
| [KAML](https://github.com/charleskorn/kaml) | 0.19.0 |
134-
| [Exposed](https://github.com/JetBrains/Exposed/) | 0.25.1 |
135-
| [HikariCP](https://github.com/brettwooldridge/HikariCP/) | 3.3.1 |
132+
| [Kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) | 1.2.0 |
133+
| [KAML](https://github.com/charleskorn/kaml) | 0.31.0 |
134+
| [Exposed](https://github.com/JetBrains/Exposed/) | 0.32.1 |
135+
| [HikariCP](https://github.com/brettwooldridge/HikariCP/) | 4.0.3 |
136136

137137
## Modules
138138
| Module | Description |

build.gradle.kts

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ subprojects {
3333
mavenLocal()
3434
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
3535
maven("https://oss.sonatype.org/content/repositories/snapshots/")
36-
maven("http://nexus.devsrsouza.com.br/repository/maven-public/")
36+
maven("http://nexus.devsrsouza.com.br/repository/maven-public/") {
37+
this.isAllowInsecureProtocol = true
38+
}
3739
maven("https://repo.codemc.org/repository/maven-public")
3840
}
3941

@@ -198,7 +200,7 @@ bukkit {
198200
website = KotlinBukkitAPI.github
199201
authors = listOf("DevSrSouza")
200202

201-
softDepend = KotlinBukkitAPI.plugins.map { it.name }
203+
// softDepend = KotlinBukkitAPI.plugins.map { it.name }
202204

203205
load = BukkitPluginDescription.PluginLoadOrder.STARTUP
204206
}

buildSrc/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88
}
99
dependencies {
1010
compileOnly(gradleApi())
11-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10")
11+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0")
1212
implementation("com.github.jengelman.gradle.plugins:shadow:6.0.0")
1313
implementation("me.bristermitten:pdm-gradle:0.0.28")
1414
}

buildSrc/src/main/kotlin/Dep.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ object Dep {
1818
}
1919

2020
object Versions {
21-
val kotlin = "1.4.10"
22-
val serialization = "1.0.0-RC"
23-
val exposed = "0.25.1"
24-
val hikari = "3.3.1"
25-
val bstats = "1.7"
21+
val kotlin = "1.5.0"
22+
val serialization = "1.2.0"
23+
val exposed = "0.31.1"
24+
val hikari = "4.0.3"
25+
val bstats = "2.2.1"
2626
val spigotApi = "1.8.8-R0.1-SNAPSHOT"
27-
val kaml = "0.22.0"
28-
val corouties = "1.3.9"
27+
val kaml = "0.31.0"
28+
val corouties = "1.5.0-RC"
2929
val skedule = "1.2.6"
30-
val shadow = "6.0.0"
30+
val shadow = "6.1.0"
3131

32-
val snakeYaml = "2.1"
32+
val snakeYaml = "2.3"
3333
}
3434
}

buildSrc/src/main/kotlin/KotlinBukkitAPI.kt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ object KotlinBukkitAPI {
55
val description = "KotlinBukkitAPI is an API for Bukkit/SpigotAPI using the cool and nifty features Kotlin has to make your life more easier."
66
val github = "https://github.com/DevSrSouza/KotlinBukkitAPI"
77

8+
@Deprecated("Only standard plugins Will be suported, Like Vault and WE")
89
val plugins = listOf(
910
Plugin("Vault", setOf("http://nexus.hc.to/content/repositories/pub_releases"), setOf("net.milkbowl.vault:VaultAPI:1.6")),
1011
Plugin("PlaceholderAPI", setOf("http://repo.extendedclip.com/content/repositories/placeholderapi/"), setOf("me.clip:placeholderapi:2.8.5")),

core/build.gradle.kts

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ dependencies {
1010

1111
testImplementation(kotlin("stdlib"))
1212
testImplementation("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT")
13-
testImplementation("org.junit.platform:junit-platform-launcher:1.3.2")
14-
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.3.2")
15-
testImplementation("org.junit.vintage:junit-vintage-engine:5.3.2")
13+
testImplementation("org.junit.platform:junit-platform-launcher:1.7.1")
14+
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.1")
15+
testImplementation("org.junit.vintage:junit-vintage-engine:5.7.1")
1616

17-
testImplementation("org.mockito:mockito-core:2.24.0")
17+
testImplementation("org.mockito:mockito-core:3.9.0")
1818
}

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/dsl/command/arguments/Item.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import net.md_5.bungee.api.chat.BaseComponent
77
import org.bukkit.ChatColor
88
import org.bukkit.Material
99
import org.bukkit.material.MaterialData
10+
import java.util.*
1011

1112
// MATERIAL
1213

1314
val MATERIAL_NOT_FOUND = "The item specified not found.".color(ChatColor.RED)
1415
val MATERIAL_MISSING_PARAMETER = "Missing item argument.".color(ChatColor.RED)
1516

1617
private fun toMaterial(string: String) = string.toIntOrNull()?.let { Material.getMaterial(it) }
17-
?: Material.getMaterial(string.toUpperCase())
18+
?: Material.getMaterial(string.uppercase(Locale.getDefault()))
1819

1920
/**
2021
* Returns [Material] or null if the Material was not found.
@@ -36,7 +37,7 @@ fun TabCompleter.material(
3637
index: Int
3738
): List<String> = argumentCompleteBuilder(index) { arg ->
3839
Material.values().mapNotNull {
39-
if(it.name.startsWith(arg, true)) it.name.toLowerCase() else null
40+
if(it.name.startsWith(arg, true)) it.name.lowercase(Locale.getDefault()) else null
4041
}
4142
}
4243

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/dsl/command/arguments/Player.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fun Executor<*>.gameModeOrNull(
5757
index: Int,
5858
argMissing: BaseComponent = GAMEMODE_MISSING_PARAMETER
5959
): GameMode? = string(index, argMissing).run {
60-
toIntOrNull()?.let { GameMode.getByValue(it) } ?: runCatching { GameMode.valueOf(this.toUpperCase()) }.getOrNull()
60+
toIntOrNull()?.let { GameMode.getByValue(it) } ?: runCatching { GameMode.valueOf(this.uppercase(Locale.getDefault())) }.getOrNull()
6161
}
6262

6363
fun Executor<*>.gameMode(
@@ -70,6 +70,6 @@ fun TabCompleter.gameMode(
7070
index: Int
7171
): List<String> = argumentCompleteBuilder(index) { arg ->
7272
GameMode.values().mapNotNull {
73-
if(it.name.startsWith(arg, true)) it.name.toLowerCase() else null
73+
if(it.name.startsWith(arg, true)) it.name.lowercase(Locale.getDefault()) else null
7474
}
7575
}

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/dsl/menu/MenuDSLImpl.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ class MenuDSLImpl(
9292
}
9393

9494
for((player, inventory) in viewersFromPlayers(players)) {
95-
for((pos, slot) in slots) {
96-
updateSlotOnlyPos(pos, slot, player, inventory)
95+
for((pos, s) in slots) {
96+
updateSlotOnlyPos(pos, s, player, inventory)
9797
}
9898
}
9999
}

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/dsl/scoreboard/ScoreboardDSLBuilder.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class ScoreboardDSLBuilder(internal val plugin: Plugin, var title: String) : Sco
172172
inline fun title(block: ScoreboardTitle.() -> Unit) = titleController(ScoreboardTitle(this).apply(block))
173173

174174
override fun show(player: Player) {
175-
val max = lines.keys.max()
175+
val max = lines.keys.maxOrNull()
176176
if (max != null) {
177177
if (_players.get(player)?.scoreboard != null) return
178178
val sb = Bukkit.getScoreboardManager().newScoreboard
@@ -276,7 +276,7 @@ class ScoreboardDSLBuilder(internal val plugin: Plugin, var title: String) : Sco
276276
}
277277

278278
override fun updateLines() {
279-
val max = lines.keys.max()
279+
val max = lines.keys.maxOrNull()
280280
if (max != null) {
281281
for (i in 1..max) {
282282
updateLine(i)

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/extensions/ExBungeeCord.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ val Player.bungeecord get() = BungeeCord(this)
1111

1212
fun Player.sendBungeeCord(message: ByteArray) = provideBungeeCordController().sendBungeeCord(this, message)
1313

14-
inline class BungeeCord(private val player: Player) {
14+
@JvmInline
15+
value class BungeeCord(private val player: Player) {
1516

1617
fun sendToServer(server: String) = BungeeCordRequest(
1718
player,
@@ -33,7 +34,7 @@ inline class BungeeCord(private val player: Player) {
3334
fun onlinePlayerAt(server: String = "ALL", callback: (playerCount: Int) -> Unit)
3435
= BungeeCordRequest(player, "PlayerCount", ByteStreams.newDataOutput().apply{writeUTF(server)}.toByteArray()) {
3536
val input = ByteStreams.newDataInput(it)
36-
val server = input.readUTF()
37+
val serverSendTo = input.readUTF()
3738
val playerCount = input.readInt()
3839
callback(playerCount)
3940
}.send()

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/extensions/ExSkedule.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ val Plugin.BukkitDispatchers get() = PluginDispatcher(this as JavaPlugin)
3939
val WithPlugin<*>.BukkitDispatchersSafe get() = plugin.BukkitDispatchersSafe
4040
val Plugin.BukkitDispatchersSafe get() = PluginDispatcher(JavaPlugin.getProvidingPlugin(this::class.java))
4141

42-
inline class PluginDispatcher(val plugin: JavaPlugin) {
42+
@JvmInline
43+
value class PluginDispatcher(val plugin: JavaPlugin) {
4344
val ASYNC get() = BukkitDispatcher(plugin, true)
4445
val SYNC get() = BukkitDispatcher(plugin, false)
4546
}

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/utils/PositionsUtils.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ fun Pair<Double, Double>.toInt() = first.toInt() to second.toInt()
7676
fun calculatePythagoras(vararg positions: Pair<Double, Double>): Pair<Double, Double> {
7777
val pow = positions.map { (x1, x2) -> (x1 * x1) to (x2 * x2) }
7878

79-
val x1Sum = pow.sumByDouble { (x, _) -> x }
80-
val x2Sum = pow.sumByDouble { (_, x) -> x }
79+
val x1Sum = pow.sumOf { (x, _) -> x }
80+
val x2Sum = pow.sumOf { (_, x) -> x }
8181

8282
val d1 = sqrt(x1Sum)
8383
val d2 = sqrt(x2Sum)

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/utils/ProviderUtils.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ fun <T : Any> Plugin.provider(kclass: KClass<T>): T? {
1212
return provideProviderController().find(this, kclass)
1313
}
1414

15-
inline class Provider(val plugin: Plugin) {
15+
@JvmInline
16+
value class Provider(val plugin: Plugin) {
1617
// false if already has a instance with the same class.
1718
fun register(any: Any): Boolean = provideProviderController().register(plugin, any)
1819

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/utils/TakeMaxTimePerTickUtils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal fun registerCoroutineContextTakes(
4848
) {
4949
coroutineContextTakes.put(
5050
coroutineContext,
51-
TakeValues(System.currentTimeMillis(), time.toLongMilliseconds())
51+
TakeValues(System.currentTimeMillis(), time.inWholeMilliseconds)
5252
)
5353
}
5454

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/utils/TimeFormatUtils.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ data class FormatLang(
3232
/**
3333
* @param time in second
3434
*/
35-
inline class TimeFormat(private val time: Long) {
35+
@JvmInline
36+
value class TimeFormat(private val time: Long) {
3637
fun format(
3738
lang: FormatLang,
3839
formatStyle: String = DEFAULT_FORMAT_STYLE,

core/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/utils/TimeUtils.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package br.com.devsrsouza.kotlinbukkitapi.utils.time
22

3-
import kotlin.time.Duration
4-
import kotlin.time.milliseconds
3+
import kotlin.time.*
54

65
fun now(): Long = System.currentTimeMillis()
76
fun nowNano(): Long = System.nanoTime()
87

98
val Long.ticks: Duration get() = toDouble().ticks
109
val Int.ticks: Duration get() = toDouble().ticks
11-
val Double.ticks: Duration get() = tickToMilliseconds(this).milliseconds
10+
val Double.ticks: Duration get() = Duration.milliseconds(tickToMilliseconds(this))
1211

13-
val Duration.inTicks: Double get() = millisecondsToTick(inMilliseconds)
12+
val Duration.inTicks: Double get() = millisecondsToTick(toDouble(DurationUnit.MILLISECONDS))
1413

1514
fun Duration.toLongTicks(): Long = inTicks.toLong()
1615

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

plugins/build.gradle.kts

-19
This file was deleted.

plugins/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/plugins/KActionBarAPI.kt

-13
This file was deleted.

0 commit comments

Comments
 (0)