Skip to content

Commit 9792fd2

Browse files
fix: namespace exception loading in PaperPlugin
1 parent 307a694 commit 9792fd2

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • npc-paper/src/main/kotlin/app/simplecloud/npc/plugin/paper

npc-paper/src/main/kotlin/app/simplecloud/npc/plugin/paper/PaperPlugin.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PaperPlugin : JavaPlugin() {
2323

2424
InterfacesListeners.install(this)
2525

26-
val namespace = loadNamespace()
26+
val namespace = loadNamespace() ?: return
2727
CommandHandler(namespace, this).parseCommands()
2828
}
2929

@@ -33,11 +33,12 @@ class PaperPlugin : JavaPlugin() {
3333
this.namespace!!.hologramManager.destroyAllHolograms()
3434
}
3535

36-
private fun loadNamespace(): NpcNamespace {
36+
private fun loadNamespace(): NpcNamespace? {
3737
val namespace = NamespaceService.findPossibleNamespace()
3838
if (namespace == null) {
3939
logger.warning("No supported NPC software was found on the server. Find the supported plugins at https://docs.simplecloud.app/plugin/npcs#usage-of-other-npc-plugins")
40-
throw NullPointerException("failed to find npc namespace")
40+
server.pluginManager.disablePlugin(this)
41+
return null
4142
}
4243

4344
logger.info("Load matching npc namespace: ${namespace.javaClass.simpleName}")

0 commit comments

Comments
 (0)