From 6d6f0b486ac42b6bd69ddb8862ee3af7b819f3a7 Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 15 Feb 2021 17:52:53 +0800 Subject: Add tests. Implementing auto backup and configuration (not finished) --- .../handler/ConcretePlayerConnectEventHandler.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main/java/com/keuin/kbackupfabric/event/handler/ConcretePlayerConnectEventHandler.java (limited to 'src/main/java/com/keuin/kbackupfabric/event') 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)); + } +} -- cgit v1.2.3