summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/event/OnPlayerConnect.java
blob: 490249b154d2c0b6f744b822773b8da1994c5ca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.keuin.kbackupfabric.event;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.network.ClientConnection;
import net.minecraft.server.network.ServerPlayerEntity;

public class OnPlayerConnect {
    public interface PlayerConnectEventCallback {
        void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player);
    }

    public static final Event<PlayerConnectEventCallback> ON_PLAYER_CONNECT = EventFactory.createArrayBacked(PlayerConnectEventCallback.class, callbacks -> (conn, player) -> {
        for (PlayerConnectEventCallback callback : callbacks) {
            callback.onPlayerConnect(conn, player);
        }
    });
}