summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/event/handler/ConcretePlayerConnectEventHandler.java
blob: 171d80da47d0fa0ed67c71115c67f3d743820915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.keuin.kbackupfabric.event.handler;

import com.keuin.kbackupfabric.autobackup.PlayerActivityTracker;
import com.keuin.kbackupfabric.event.OnPlayerConnect;
import com.keuin.kbackupfabric.notification.DistinctNotifiable;
import com.keuin.kbackupfabric.notification.NotificationManager;
import net.minecraft.network.ClientConnection;
import net.minecraft.server.network.ServerPlayerEntity;

public class ConcretePlayerConnectEventHandler implements OnPlayerConnect.PlayerConnectEventCallback {
    private final PlayerActivityTracker playerActivityTracker;

    public ConcretePlayerConnectEventHandler(PlayerActivityTracker playerActivityTracker) {
        this.playerActivityTracker = playerActivityTracker;
    }

    @Override
    public void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player) {
        playerActivityTracker.setCheckpoint();
        NotificationManager.INSTANCE.notifyPlayer(DistinctNotifiable.fromServerPlayerEntity(player));
    }
}