Skip to content

Commit 26b75fd

Browse files
committed
Exception while overriding native commands fixed.
Incorrect base implementation class checking fixed. Removed redundant new line in `ServerMessagingAPI.listAsResponse`. `org.json:json` included in mod bundle. Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent eade6f7 commit 26b75fd

File tree

9 files changed

+51
-35
lines changed

9 files changed

+51
-35
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dependencies {
4444
implementation "com.mojang:brigadier:$brigadier_version"
4545
internal "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlinx_serialization_version"
4646
internal "org.jetbrains.kotlin:kotlin-stdlib-$kotlin_jdk_version_target:$kotlin_version"
47-
implementation group: 'org.json', name: 'json', version: '20190722'
47+
internal group: 'org.json', name: 'json', version: '20190722'
4848
}
4949

5050
dokka {

changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.0.0-RC.4] - 2020-05-15
10+
11+
### Added
12+
- `org.json:json` included in mod bundle.
13+
14+
### Changed
15+
- Removed redundant new line in `ServerMessagingAPI.listAsResponse`.
16+
17+
### Fixed
18+
- Exception while overriding native commands.
19+
- Incorrect base implementation class checking.
20+
921
## [2.0.0-RC.3] - 2020-05-15
1022

1123
### Added

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ kotlin.code.style=official
1616
kotlin_version=1.3.72
1717
kotlinx_serialization_version=0.20.0
1818
# Module informatation.
19-
module_version=2.0.0-RC.3+MC-1.14.4
19+
module_version=2.0.0-RC.4+MC-1.14.4
2020
module_name=Project Essentials Core
2121
module_id=project_essentials_core
2222
module_vendor=MairwunNx (Pavel Erokhin)

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/configuration/ConfigurationProcessor.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ internal object ConfigurationProcessor : IProcessor {
4949
}
5050
}
5151

52-
private fun isConfiguration(clazz: Class<*>) = clazz is IConfiguration<*>
52+
private fun isConfiguration(clazz: Class<*>) =
53+
IConfiguration::class.java.isAssignableFrom(clazz)
5354

5455
override fun postProcess() {
5556
getConfigurations().forEach {

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/messaging/ServerMessagingAPI.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ object ServerMessagingAPI {
4545
*/
4646
fun listAsResponse(list: List<String>, title: () -> String) = response {
4747
"""
48-
4948
${title()}
5049
5150
${list.joinToString(separator = ",\n") { " > $it" }}

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/module/ModuleProcessor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ internal object ModuleProcessor : IProcessor {
6767
}
6868
}
6969

70-
private fun isModule(clazz: Class<*>) = clazz is IModule
70+
private fun isModule(clazz: Class<*>) = IModule::class.java.isAssignableFrom(clazz)
7171

7272
private fun getInstanceModId(clazz: Class<*>) =
7373
clazz.getAnnotation(Mod::class.java)?.value ?: String.empty

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/providers/ProviderAPI.kt

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,35 +42,37 @@ object ProviderAPI {
4242
* @since 2.0.0-SNAPSHOT.1.
4343
*/
4444
@Synchronized
45-
fun addProvider(clazz: Class<*>) = when (clazz) {
46-
is IConfiguration<*> -> {
47-
addProvider(ProviderType.CONFIGURATION, clazz).run {
48-
logger.debug(
49-
marker,
50-
"Provider class founded: Type: `Configuration`, Class: `${clazz.simpleName}`"
51-
)
45+
fun addProvider(clazz: Class<*>) {
46+
when {
47+
IConfiguration::class.java.isAssignableFrom(clazz) -> {
48+
addProvider(ProviderType.CONFIGURATION, clazz).run {
49+
logger.debug(
50+
marker,
51+
"Provider class founded: Type: `Configuration`, Class: `${clazz.simpleName}`"
52+
)
53+
}
5254
}
53-
}
54-
is IModule -> {
55-
addProvider(ProviderType.MODULE, clazz).run {
56-
logger.debug(
57-
marker,
58-
"Provider class founded: Type: `Module`, Class: `${clazz.simpleName}`"
59-
)
55+
IModule::class.java.isAssignableFrom(clazz) -> {
56+
addProvider(ProviderType.MODULE, clazz).run {
57+
logger.debug(
58+
marker,
59+
"Provider class founded: Type: `Module`, Class: `${clazz.simpleName}`"
60+
)
61+
}
6062
}
61-
}
62-
is ICommand -> {
63-
addProvider(ProviderType.COMMAND, clazz).run {
64-
logger.debug(
65-
marker,
66-
"Provider class founded: Type: `Command`, Class: `${clazz.simpleName}`"
67-
)
63+
ICommand::class.java.isAssignableFrom(clazz) -> {
64+
addProvider(ProviderType.COMMAND, clazz).run {
65+
logger.debug(
66+
marker,
67+
"Provider class founded: Type: `Command`, Class: `${clazz.simpleName}`"
68+
)
69+
}
6870
}
71+
else -> logger.warn(
72+
marker,
73+
"Incorrect provider class found! (skipped to load): Class: `${clazz.simpleName}`"
74+
)
6975
}
70-
else -> logger.warn(
71-
marker,
72-
"Incorrect provider class found! (skipped to load): Class: `${clazz.simpleName}`"
73-
)
7476
}
7577

7678
/**

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/ModuleObject.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,17 @@ internal class ModuleObject : IModule {
7676

7777
@SubscribeEvent
7878
fun onServerStarting(event: FMLServerStartingEvent) {
79-
if (generalConfiguration.getBool(SETTING_NATIVE_COMMAND_REPLACE)) {
80-
registerNativeCommands(event.commandDispatcher, event.server.isDedicatedServer)
81-
}
82-
8379
dudeFuckedOff = File(
8480
projectConfigDirectory + File.separator + "fuck-off-dude.txt"
8581
).exists().also { if (!it) printGreetingMessage() }
8682

8783
CommandAPI.assignDispatcherRoot(event.commandDispatcher)
8884
CommandAPI.assignDispatcher(event.commandDispatcher)
85+
86+
if (generalConfiguration.getBool(SETTING_NATIVE_COMMAND_REPLACE)) {
87+
registerNativeCommands(event.commandDispatcher, event.server.isDedicatedServer)
88+
}
89+
8990
ProcessorAPI.getProcessorByName("command").postProcess()
9091
}
9192

updatev2.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"homepage": "https://github.com/ProjectEssentials/ProjectEssentials-Core",
33
"1.14.4": {
4+
"2.0.0-RC.4": "change log -> https://git.io/JfRaD",
45
"2.0.0-RC.3": "change log -> https://git.io/JfRlp",
56
"2.0.0-RC.2": "change log -> https://git.io/JfBYX",
67
"2.0.0-RC.1": "change log -> https://git.io/JfC5F"
78
},
89
"promos": {
9-
"1.14.4-latest": "2.0.0-RC.3",
10+
"1.14.4-latest": "2.0.0-RC.4",
1011
"1.14.4-recommended": "2.0.0"
1112
}
1213
}

0 commit comments

Comments
 (0)