Skip to content

Commit

Permalink
JSLoader: Remove runtime field/method widener warnings
Browse files Browse the repository at this point in the history
ModuleManager already warns if the user imports a module with mixins, so
not only is this warning incorrect (it printed every /ct load), it is
useless as well
  • Loading branch information
mattco98 committed Jan 8, 2024
1 parent 79e7b14 commit a1dbb78
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/main/kotlin/com/chattriggers/ctjs/internal/engine/JSLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -265,25 +265,13 @@ object JSLoader {
}

fun registerFieldWidener(mixin: Mixin, fieldName: String, isMutable: Boolean) {
if (mixinsFinalized) {
if (mixins[mixin]?.fieldWideners?.contains(fieldName) != null) {
("A new field widener was registered at runtime. This will require a restart, and will " +
"have no effect until then!").printToConsole()
}
} else {
if (!mixinsFinalized)
mixins.getOrPut(mixin, ::MixinDetails).fieldWideners[fieldName] = isMutable
}
}

fun registerMethodWidener(mixin: Mixin, methodName: String, isMutable: Boolean) {
if (mixinsFinalized) {
if (mixins[mixin]?.methodWideners?.contains(methodName) != null) {
("A new method widener was registered at runtime. This will require a restart, and will " +
"have no effect until then!").printToConsole()
}
} else {
if (!mixinsFinalized)
mixins.getOrPut(mixin, ::MixinDetails).methodWideners[methodName] = isMutable
}
}

/**
Expand Down

0 comments on commit a1dbb78

Please sign in to comment.