Skip to content

Instantly share code, notes, and snippets.

typealias Event<Listener> = Toggled.(Listener) -> (Unit)
open class TreeEvent<Listener> : (Toggled, Listener) -> (Unit), Iterable<Listener> {
protected val listeners = TreeMap<Int, Listener>()
protected var index = 0
override fun iterator() = listeners.values.iterator()
override fun invoke(scope: Toggled, listener: Listener) = scope.run {
val current = index++
interface Pathfinder {
//boolean canStart()
default boolean a() { return false; }
//boolean canTick()
default boolean b() { return a(); }
//boolean canStop()
default boolean f() { return true; }
//void onStart()
default void c() {}
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
public class MessageFilter implements Listener {
private static final String
HANDLER = "packet_handler",
CUSTOM_HANDLER = "custom_packet_handler";
private static final Field
FIELD_COMPONENT,
FIELD_CONNECTION,
FIELD_NETWORK,
FIELD_CHANNEL;
private static final Method
@Exerosis
Exerosis / Events.java
Last active January 15, 2024 06:37
A simpler and faster system for registering Bukkit event listeners in Java, Kotlin or Scala.
import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.EventExecutor;
import java.util.function.Consumer;
public interface Events extends Listener, EventExecutor {
@Exerosis
Exerosis / Events.java
Last active September 10, 2018 09:16
A simpler faster system for registering bukkit event listeners. Scala Version: https://git.io/fAaV0
import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.EventExecutor;
import java.util.function.Consumer;
public interface Events extends Listener, EventExecutor {
@Exerosis
Exerosis / pom.xml
Created August 4, 2018 07:17
Redisson Spigot Pom
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
package com.gitlab.avelyn.core.utilities;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import com.penzzly.engine.architecture.base.Component;
import com.penzzly.engine.core.utilites.io.FileUtil;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.entity.Player;
import org.bukkit.event.world.WorldLoadEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;