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

top.hendrixshen.magiclib.impl.event.minecraft.MinecraftServerEvent Maven / Gradle / Ivy

There is a newer version: 0.6.59
Show newest version
package top.hendrixshen.magiclib.impl.event.minecraft;

import lombok.AllArgsConstructor;
import net.minecraft.server.MinecraftServer;
import org.jetbrains.annotations.NotNull;
import top.hendrixshen.magiclib.api.event.Event;
import top.hendrixshen.magiclib.api.event.minecraft.MinecraftServerListener;

import java.util.List;

public class MinecraftServerEvent {
    @AllArgsConstructor
    public static class ServerLoadedEvent implements Event {
        private final MinecraftServer server;

        @Override
        public void dispatch(@NotNull List listeners) {
            listeners.forEach(listener -> listener.onServerLoaded(this.server));
        }

        @Override
        public Class getListenerType() {
            return MinecraftServerListener.class;
        }
    }

    @AllArgsConstructor
    public static class ServerLevelLoadedEvent implements Event {
        private final MinecraftServer server;

        @Override
        public void dispatch(@NotNull List listeners) {
            listeners.forEach(listener -> listener.onServerLoaded(this.server));
        }

        @Override
        public Class getListenerType() {
            return MinecraftServerListener.class;
        }
    }

    @AllArgsConstructor
    public static class ServerCloseEvent implements Event {
        private final MinecraftServer server;

        @Override
        public void dispatch(@NotNull List listeners) {
            listeners.forEach(listener -> listener.onServerClosed(this.server));
        }

        @Override
        public Class getListenerType() {
            return MinecraftServerListener.class;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy