Effortlessly manage events in your Kotlin-based application with Piko, a lightweight and flexible event management library. Simplify the process of registering listeners and triggering events with ease.
Important
Piko is specifically designed for Kotlin and works best when used with Kotlinβs coding style. Itβs strongly recommended to use it exclusively with Kotlin.
- Lightweight Framework: Provides a streamlined framework for managing events and listeners.
- Intuitive API: Offers an easy-to-use API for registering and triggering events.
- Reduced Boilerplate: Minimizes boilerplate code by centralizing event management.
- Maintainable Logic: Organizes listeners clearly to keep logic maintainable and easy to track.
Make sure to replace ${version}
with the latest version of Piko!
Gradle (Kotlin DSL)
repositories {
mavenCentral()
}
dependencies {
implementation("dev.lyzev.api", "piko", "${version}")
}
Gradle (Version Catalog)
[versions]
piko = "${version}"
[libraries]
piko = { module = "dev.lyzev.api:piko", version.ref = "piko" }
Gradle (Groovy DSL)
repositories {
mavenCentral()
}
dependencies {
implementation 'dev.lyzev.api:piko:${version}'
}
Maven
<dependencies>
<dependency>
<groupId>dev.lyzev.api</groupId>
<artifactId>piko</artifactId>
<version>${version}</version>
</dependency>
</dependencies>
Raw Jar
- Visit the Maven Central Repository and download the JAR file for the version you need.
- Add the downloaded JAR to your project.
Event Listener Example
Below is a simple example demonstrating how to implement an event listener.
import dev.lyzev.api.event.Event
import dev.lyzev.api.event.EventListener
import dev.lyzev.api.event.on
class TestEventListener : EventListener {
var handle = true
init {
on<TestEvent>(Event.Priority.HIGH) { event ->
if (event.a == 5)
event.isCancelled = true
println("TestEvent: ${event.a}")
}
}
override val shouldHandleEvents
get() = handle
}
In this example:
- We define a
TestEventListener
that implementsEventListener
. - The
handle
variable determines whether the listener should process events. - Changing
handle
allows enabling or disabling event handling. - The
on<TestEvent>
function insideinit
registers the listener forTestEvent
. Event.Priority.HIGH
makes sure this listener runs before lower-priority ones.- If
event.a == 5
, the event is canceled, preventing further processing.
Event Example
Below is a simple example demonstrating how to create an event.
import dev.lyzev.api.event.CancellableEvent
class TestEvent(val a: Int) : CancellableEvent()
- We define a
TestEvent
class that extendsCancellableEvent
. - The class has a single property,
a
, which stores an integer value. - Since
TestEvent
extendsCancellableEvent
, it can be canceled by event listeners.
Tip
The library is quite intuitive, so it's a good idea to try it out. You'll quickly learn its capabilities.
Warning
This documentation is automatically generated by Dokka.
For documentation, check out the Piko Documentation.
For bugs or suggestions, please submit them via the GitHub Issue Tracker. Be sure to use the provided templates and include all relevant details to help us understand your issue and resolve it swiftly. Your cooperation is greatly appreciated!
Need assistance or have minor questions? Join our welcoming community on the Discord server. Our members and staff are always ready to help!
We welcome contributions from the community! Please read our Contribution Guidelines to get started.
Please review our Security Policy to understand how we handle security vulnerabilities.
Caution
Please do not publicly disclose the vulnerability until it has been fixed.
Copyright (C) 2025 Lyzev
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/agpl-3.0.en.html.
Piko is developed and maintained by Schizoid Development. Thank you for using Piko!