diff options
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/event/handler')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/event/handler/ConcretePlayerConnectEventHandler.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/event/handler/ConcretePlayerConnectEventHandler.java b/src/main/java/com/keuin/kbackupfabric/event/handler/ConcretePlayerConnectEventHandler.java new file mode 100644 index 0000000..171d80d --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/event/handler/ConcretePlayerConnectEventHandler.java @@ -0,0 +1,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)); + } +} |