Skip to content

Commit 643e2b9

Browse files
authored
Merge pull request #127 from Shynixn/development
Merge changes to master --release
2 parents c7de1e8 + 968ca36 commit 643e2b9

File tree

25 files changed

+465
-51
lines changed

25 files changed

+465
-51
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ tasks.register("printVersion") {
4343

4444
subprojects {
4545
group 'com.github.shynixn.mccoroutine'
46-
version '2.19.0'
46+
version '2.20.0'
4747

4848
sourceCompatibility = 1.8
4949

docs/wiki/docs/installation.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,62 @@ In order to use the MCCoroutine Kotlin API, you need to include the following li
88

99
```groovy
1010
dependencies {
11-
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.19.0")
12-
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.19.0")
11+
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.20.0")
12+
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.20.0")
1313
}
1414
```
1515

1616
=== "BungeeCord"
1717

1818
```groovy
1919
dependencies {
20-
implementation("com.github.shynixn.mccoroutine:mccoroutine-bungeecord-api:2.19.0")
21-
implementation("com.github.shynixn.mccoroutine:mccoroutine-bungeecord-core:2.19.0")
20+
implementation("com.github.shynixn.mccoroutine:mccoroutine-bungeecord-api:2.20.0")
21+
implementation("com.github.shynixn.mccoroutine:mccoroutine-bungeecord-core:2.20.0")
2222
}
2323
```
2424

2525
=== "Fabric"
2626

2727
```groovy
2828
dependencies {
29-
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-api:2.19.0")
30-
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-core:2.19.0")
29+
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-api:2.20.0")
30+
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-core:2.20.0")
3131
}
3232
```
3333

3434
=== "Folia"
3535

3636
```groovy
3737
dependencies {
38-
implementation("com.github.shynixn.mccoroutine:mccoroutine-folia-api:2.19.0")
39-
implementation("com.github.shynixn.mccoroutine:mccoroutine-folia-core:2.19.0")
38+
implementation("com.github.shynixn.mccoroutine:mccoroutine-folia-api:2.20.0")
39+
implementation("com.github.shynixn.mccoroutine:mccoroutine-folia-core:2.20.0")
4040
}
4141
```
4242

4343
=== "Minestom"
4444

4545
```groovy
4646
dependencies {
47-
implementation("com.github.shynixn.mccoroutine:mccoroutine-minestom-api:2.19.0")
48-
implementation("com.github.shynixn.mccoroutine:mccoroutine-minestom-core:2.19.0")
47+
implementation("com.github.shynixn.mccoroutine:mccoroutine-minestom-api:2.20.0")
48+
implementation("com.github.shynixn.mccoroutine:mccoroutine-minestom-core:2.20.0")
4949
}
5050
```
5151

5252
=== "Sponge"
5353

5454
```groovy
5555
dependencies {
56-
implementation("com.github.shynixn.mccoroutine:mccoroutine-sponge-api:2.19.0")
57-
implementation("com.github.shynixn.mccoroutine:mccoroutine-sponge-core:2.19.0")
56+
implementation("com.github.shynixn.mccoroutine:mccoroutine-sponge-api:2.20.0")
57+
implementation("com.github.shynixn.mccoroutine:mccoroutine-sponge-core:2.20.0")
5858
}
5959
```
6060

6161
=== "Velocity"
6262

6363
```groovy
6464
dependencies {
65-
implementation("com.github.shynixn.mccoroutine:mccoroutine-velocity-api:2.19.0")
66-
implementation("com.github.shynixn.mccoroutine:mccoroutine-velocity-core:2.19.0")
65+
implementation("com.github.shynixn.mccoroutine:mccoroutine-velocity-api:2.20.0")
66+
implementation("com.github.shynixn.mccoroutine:mccoroutine-velocity-core:2.20.0")
6767
}
6868
```
6969

@@ -87,17 +87,17 @@ dependencies {
8787
**plugin.yml**
8888
```yaml
8989
libraries:
90-
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.19.0
91-
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.19.0
90+
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.20.0
91+
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.20.0
9292
```
9393

9494
=== "Folia"
9595

9696
**plugin.yml**
9797
```yaml
9898
libraries:
99-
- com.github.shynixn.mccoroutine:mccoroutine-folia-api:2.19.0
100-
- com.github.shynixn.mccoroutine:mccoroutine-folia-core:2.19.0
99+
- com.github.shynixn.mccoroutine:mccoroutine-folia-api:2.20.0
100+
- com.github.shynixn.mccoroutine:mccoroutine-folia-core:2.20.0
101101
```
102102

103103

docs/wiki/docs/unittests.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Unit-Tests with MCCoroutine
22

3-
(This site is only relevant for Spigot, Paper and CraftBukkit. If you need Unit-Tests support for BungeeCord, Sponge or
4-
Velocity, please submit an issue on GitHub)
3+
Unit-Test support is only available for ``mccoroutine-bukkit`` and ``mccoroutine-folia``. Please create a GitHub ticket, if you want support for other libraries.
54

65
If you try to write Unit- or IntegrationTests for your Minecraft plugin, you may need to test suspend functions. These
76
functions
@@ -16,11 +15,21 @@ feedback to the real environment.
1615

1716
**Do not** shade this library into your final plugin.jar file. This should only be available during UnitTests.
1817

19-
```kotlin
20-
dependencies {
21-
testImplementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-test:2.19.0")
22-
}
23-
```
18+
=== "Bukkit"
19+
20+
```kotlin
21+
dependencies {
22+
testImplementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-test:2.20.0")
23+
}
24+
```
25+
26+
=== "Folia"
27+
28+
```kotlin
29+
dependencies {
30+
testImplementation("com.github.shynixn.mccoroutine:mccoroutine-folia-test:2.20.0")
31+
}
32+
```
2433

2534
### 2. Create a test method
2635

mccoroutine-bukkit-sample/src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: MCCoroutine-Sample
2-
version: 2.19.0
2+
version: 2.20.0
33
author: Shynixn
44
main: com.github.shynixn.mccoroutine.bukkit.sample.MCCoroutineSamplePlugin
55
commands:

mccoroutine-bungeecord-sample/src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: MCCoroutine-Sample
2-
version: 2.19.0
2+
version: 2.20.0
33
author: Shynixn
44
main: com.github.shynixn.mccoroutine.bungeecord.sample.MCCoroutineSamplePlugin
55
commands:

mccoroutine-fabric-sample/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ repositories {
99
mavenLocal()
1010
}
1111
dependencies {
12-
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-api:2.19.0")
13-
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-core:2.19.0")
12+
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-api:2.20.0")
13+
implementation("com.github.shynixn.mccoroutine:mccoroutine-fabric-core:2.20.0")
1414

1515
minecraft("com.mojang", "minecraft", project.extra["minecraft_version"] as String)
1616
mappings("net.fabricmc", "yarn", project.extra["yarn_mappings"] as String, null, "v2")

mccoroutine-folia-sample/src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: MCCoroutine-Sample
2-
version: 2.19.0
2+
version: 2.20.0
33
author: Shynixn
44
main: com.github.shynixn.mccoroutine.folia.sample.MCCoroutineSamplePlugin
55
folia-supported: true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
repositories {
4+
maven {
5+
url = uri("https://repo.papermc.io/repository/maven-public/")
6+
}
7+
}
8+
9+
10+
java {
11+
toolchain {
12+
languageVersion.set(JavaLanguageVersion.of(17))
13+
}
14+
}
15+
16+
tasks.withType<KotlinCompile>().configureEach {
17+
kotlinOptions {
18+
jvmTarget = "17"
19+
}
20+
}
21+
22+
dependencies {
23+
implementation(project(":mccoroutine-folia-api"))
24+
25+
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
26+
compileOnly("dev.folia:folia-api:1.20.1-R0.1-20230615.235213-1")
27+
28+
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
29+
testImplementation("dev.folia:folia-api:1.20.1-R0.1-20230615.235213-1")
30+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.github.shynixn.mccoroutine.folia.test
2+
3+
import com.github.shynixn.mccoroutine.folia.test.impl.TestMCCoroutineImpl
4+
5+
interface TestMCCoroutine {
6+
companion object {
7+
/**
8+
* The driver to load the test implementation of MCCoroutine.
9+
* Useful for UnitTests.
10+
*/
11+
val Driver = TestMCCoroutineImpl::class.java.name
12+
}
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.github.shynixn.mccoroutine.folia.test.dispatcher
2+
3+
import kotlinx.coroutines.CoroutineDispatcher
4+
import kotlinx.coroutines.Runnable
5+
import java.util.concurrent.ExecutorService
6+
import java.util.concurrent.Executors
7+
import kotlin.coroutines.CoroutineContext
8+
9+
internal class TestMainCoroutineDispatcher : CoroutineDispatcher() {
10+
private val threadPool: ExecutorService = Executors.newFixedThreadPool(1)
11+
var threadId: Long? = null
12+
13+
init {
14+
threadPool.submit {
15+
Thread.currentThread().name = "[PluginMainThread]"
16+
threadId = Thread.currentThread().id
17+
}
18+
}
19+
20+
override fun isDispatchNeeded(context: CoroutineContext): Boolean {
21+
return Thread.currentThread().id != threadId
22+
}
23+
24+
override fun dispatch(context: CoroutineContext, block: Runnable) {
25+
threadPool.submit {
26+
block.run()
27+
}
28+
}
29+
30+
fun dispose() {
31+
threadPool.shutdown()
32+
}
33+
}

0 commit comments

Comments
 (0)