All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.silkmc.silk.igui.GuiUseable.kt Maven / Gradle / Ivy

There is a newer version: 1.10.7
Show newest version
package net.silkmc.silk.igui

abstract class GuiUseable {
    protected val registeredGuis = HashSet()

    var inUse = false
        private set

    protected open fun onChangeUseStatus(inUse: Boolean) { }

    internal open fun startUsing(gui: Gui) {
        if (registeredGuis.isEmpty()) {
            inUse = true
            onChangeUseStatus(true)
        }
        registeredGuis += gui
    }

    internal open fun stopUsing(gui: Gui) {
        registeredGuis -= gui
        if (registeredGuis.isEmpty()) {
            inUse = false
            onChangeUseStatus(false)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy