package ru.dbotthepony.mc.otm.menu.input

import ru.dbotthepony.mc.otm.core.GetterSetter
import ru.dbotthepony.mc.otm.menu.MatteryMenu
import java.util.function.BooleanSupplier

class InstantBooleanInput(menu: MatteryMenu) : GetterSetter<Boolean>, BooleanSupplier {
	var value = false
		private set

	val input = menu.booleanInput(true) { value = it }

	override fun get(): Boolean {
		return value
	}

	override fun getAsBoolean(): Boolean {
		return value
	}

	override fun accept(t: Boolean) {
		value = t
		input.input(t)
	}
}
