mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
try catch other plugin's listeners
This commit is contained in:
parent
2070f8fd68
commit
3594cf72af
1 changed files with 13 additions and 2 deletions
|
|
@ -46,7 +46,13 @@ open class GenericPluginDependency(protected open val plugin: Plugin, private va
|
|||
event.result = null
|
||||
|
||||
for (registeredListener in preAnvil) {
|
||||
// We do not want error from another plugin to be our fault
|
||||
try {
|
||||
registeredListener.callEvent(event)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
if (event.result != null) return true
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +64,12 @@ open class GenericPluginDependency(protected open val plugin: Plugin, private va
|
|||
if(!testPrepare) return false
|
||||
|
||||
for (registeredListener in postAnvil) {
|
||||
// We do not want error from another plugin to be our fault
|
||||
try {
|
||||
registeredListener.callEvent(event)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
if (event.inventory.getItem(2) == null) return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue