Update GUI.kt

This commit is contained in:
bluefireoly
2020-10-30 16:09:02 +01:00
parent 03da16f631
commit c6e7cf4982

View File

@@ -217,8 +217,16 @@ class GUIInstance<T : ForInventory>(
* Stops KSpigot from listening to actions in this
* GUI anymore.
*/
@Suppress("UNCHECKED_CAST")
fun unregister() = GUIHolder.unregister(this as GUIInstance<ForInventory>)
fun unregister() {
@Suppress("UNCHECKED_CAST")
GUIHolder.unregister(this as GUIInstance<ForInventory>)
// unregister this inv from all elements
currentElements.forEach { it.stopUsing(this) }
currentElements.clear()
}
/**
* @return True, if the [inventory] belongs to this GUI.