Skip to content

Commit 6f4921e

Browse files
authored
Merge pull request #86 from Shynixn/development
Merge changes to Master --release
2 parents b23a1d8 + 2ece5fa commit 6f4921e

File tree

13 files changed

+30
-26
lines changed

13 files changed

+30
-26
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
*.iml
33
local.properties
44
*.log
5-
*.class
5+
*.class
6+
.gradle
7+
build

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ private suspend fun bob() {
6060

6161
## Getting started
6262

63-
* [User Guide](https://shynixn.github.io/MCCoroutine/wiki/site/)
63+
* [Wiki and User Guide](https://shynixn.github.io/MCCoroutine/wiki/site/)
64+
65+
## Resources
66+
6467
* [MCCoroutine JavaDocs for the Bukkit-API](https://shynixn.github.io/MCCoroutine/apidocs/mccoroutine-root/com.github.shynixn.mccoroutine.bukkit/index.html)
6568
* [MCCoroutine JavaDocs for the Sponge-API](https://shynixn.github.io/MCCoroutine/apidocs/mccoroutine-root/com.github.shynixn.mccoroutine.sponge/index.html)
6669
* [MCCoroutine JavaDocs for the BungeeCord-API](https://shynixn.github.io/MCCoroutine/apidocs/mccoroutine-root/com.github.shynixn.mccoroutine.bungeecord/index.html)

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.6.0'
46+
version '2.7.0'
4747

4848
sourceCompatibility = 1.8
4949

docs/wiki/docs/installation.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,35 @@ 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.6.0")
12-
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.6.0")
11+
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.7.0")
12+
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.7.0")
1313
}
1414
```
1515

1616
=== "BungeeCord"
1717

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

2525
=== "Sponge"
2626

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

3434
=== "Velocity"
3535

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

@@ -60,8 +60,8 @@ dependencies {
6060
**plugin.yml**
6161
```yaml
6262
libraries:
63-
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.6.0
64-
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.6.0
63+
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.7.0
64+
- com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.7.0
6565
```
6666

6767
=== "Other Server"

docs/wiki/docs/plugindisable.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO

docs/wiki/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ nav:
1313
- 'Suspending Delayed, Repeating Tasks': tasks.md
1414
- 'Suspending API Functions': bridge.md
1515
- 'Suspending Caches, Background Repeating Tasks': caching.md
16+
# - 'Launching coroutines in onDisable': plugindisable.md
1617
- 'Exception Handling': exception.md
1718
- 'Timing Measurements': timings.md
1819
- 'FAQ': faq.md

mccoroutine-bukkit-api/src/main/java/com/github/shynixn/mccoroutine/bukkit/MCCoroutineExceptionEvent.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.github.shynixn.mccoroutine.bukkit
22

33
import org.bukkit.event.Cancellable
4-
import org.bukkit.event.server.PluginEvent
54
import org.bukkit.event.HandlerList
5+
import org.bukkit.event.server.ServerEvent
66
import org.bukkit.plugin.Plugin
77

88
/**
@@ -13,12 +13,13 @@ class MCCoroutineExceptionEvent(
1313
/**
1414
* Plugin causing the exception.
1515
*/
16-
plugin: Plugin,
16+
val plugin: Plugin,
1717
/**
1818
* The exception to be logged.
1919
*/
2020
val exception: Throwable
21-
) : PluginEvent(plugin), Cancellable {
21+
// Paper requires explicit isAsync false flag.
22+
) : ServerEvent(false), Cancellable {
2223
private var cancelled: Boolean = false
2324

2425
/**

mccoroutine-bukkit-core/src/main/java/com/github/shynixn/mccoroutine/bukkit/dispatcher/AsyncCoroutineDispatcher.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@ internal open class AsyncCoroutineDispatcher(
2020
*/
2121
override fun isDispatchNeeded(context: CoroutineContext): Boolean {
2222
wakeUpBlockService.ensureWakeup()
23-
return plugin.server.isPrimaryThread
23+
return plugin.server.isPrimaryThread && plugin.isEnabled
2424
}
2525

2626
/**
2727
* Handles dispatching the coroutine on the correct thread.
2828
*/
2929
override fun dispatch(context: CoroutineContext, block: Runnable) {
30-
if (!plugin.isEnabled) {
31-
return
32-
}
33-
3430
plugin.server.scheduler.runTaskAsynchronously(plugin, block)
3531
}
3632
}

mccoroutine-bukkit-core/src/main/java/com/github/shynixn/mccoroutine/bukkit/dispatcher/MinecraftCoroutineDispatcher.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal open class MinecraftCoroutineDispatcher(
2121
*/
2222
override fun isDispatchNeeded(context: CoroutineContext): Boolean {
2323
wakeUpBlockService.ensureWakeup()
24-
return !plugin.server.isPrimaryThread
24+
return !plugin.server.isPrimaryThread && plugin.isEnabled
2525
}
2626

2727
/**

mccoroutine-bukkit-core/src/main/java/com/github/shynixn/mccoroutine/bukkit/impl/MCCoroutineImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MCCoroutineImpl : MCCoroutine {
4040
*/
4141
private fun startCoroutineSession(plugin: Plugin) {
4242
if (!plugin.isEnabled) {
43-
throw RuntimeException("Plugin ${plugin.name} attempt to start a new coroutine session while being disabled. Dispatchers such as plugin.minecraftDispatcher and plugin.asyncDispatcher are already disposed at this point and cannot be used!")
43+
throw RuntimeException("Plugin ${plugin.name} attempt to start a new coroutine session while being disabled. Dispatchers such as plugin.minecraftDispatcher and plugin.asyncDispatcher are already disposed at this point and cannot be used! If you are starting a coroutine in onDisable, consider using runBlocking instead.")
4444
}
4545

4646
val pluginListener = PluginListener(this, plugin)

0 commit comments

Comments
 (0)