generated from Kord-Extensions/template
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make mods aware of their location * Add processor to request crash reports * Add fabric apis on quilt processor * Add the two new processors * Fix some names * Update regexes This allows parsing crash report mod tables, it wasn't working before. The change doesn't break anything
- Loading branch information
1 parent
84fd490
commit 4a1d098
Showing
13 changed files
with
91 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...rc/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/CrashReportProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.quiltmc.community.cozy.modules.logs.processors | ||
|
||
import dev.kord.core.event.Event | ||
import org.quiltmc.community.cozy.modules.logs.data.Log | ||
import org.quiltmc.community.cozy.modules.logs.data.Order | ||
import org.quiltmc.community.cozy.modules.logs.types.LogProcessor | ||
|
||
private val CRASH_REPORT_REGEX = "Crashed! The full crash report has been saved to (\\S+)" | ||
.toRegex(RegexOption.IGNORE_CASE) | ||
|
||
public class CrashReportProcessor : LogProcessor() { | ||
override val identifier: String = "crash-reports" | ||
override val order: Order = Order.Default | ||
|
||
override suspend fun predicate(log: Log, event: Event): Boolean = | ||
CRASH_REPORT_REGEX.find(log.content) != null | ||
|
||
override suspend fun process(log: Log) { | ||
val match = CRASH_REPORT_REGEX.find(log.content) ?: return | ||
log.addMessage("Please also provide the crash report at `${match.groups[1]!!.value}`") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...in/kotlin/org/quiltmc/community/cozy/modules/logs/processors/quilt/FabricApisProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.quiltmc.community.cozy.modules.logs.processors.quilt | ||
|
||
import dev.kord.core.event.Event | ||
import org.quiltmc.community.cozy.modules.logs.data.LoaderType | ||
import org.quiltmc.community.cozy.modules.logs.data.Log | ||
import org.quiltmc.community.cozy.modules.logs.data.Order | ||
import org.quiltmc.community.cozy.modules.logs.types.LogProcessor | ||
|
||
public class FabricApisProcessor : LogProcessor() { | ||
override val identifier: String = "quilt-fabric-apis" | ||
override val order: Order = Order.Default | ||
|
||
override suspend fun predicate(log: Log, event: Event): Boolean = | ||
log.getLoaderVersion(LoaderType.Quilt) != null | ||
|
||
override suspend fun process(log: Log) { | ||
val fabricApi = log.getMod("fabric") | ||
val fabricLanguageKotlin = log.getMod("fabric-language-kotlin") | ||
|
||
if (fabricApi != null) { | ||
log.hasProblems = true | ||
|
||
log.addMessage( | ||
"Fabric API is present at `${fabricApi.path}`, and should be replaced by [QSL](https://modrinth.com/mod/qsl)" | ||
) | ||
} | ||
|
||
if (fabricLanguageKotlin != null) { | ||
log.hasProblems = true | ||
|
||
log.addMessage( | ||
"Fabric Language Kotlin is present at `${fabricLanguageKotlin.path}`, " + | ||
"and should be replaced by [QKL](https://modrinth.com/mod/qkl)" | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters