summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/event/handler
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-02-15 17:52:53 +0800
committerKeuin <[email protected]>2021-02-15 17:52:53 +0800
commit6d6f0b486ac42b6bd69ddb8862ee3af7b819f3a7 (patch)
treece01c3a18b7e90af6204ff0db90a606eade81778 /src/main/java/com/keuin/kbackupfabric/event/handler
parent68b102c763b0d0b21fb71575f1238d3cc879f959 (diff)
Add tests.
Implementing auto backup and configuration (not finished)
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/event/handler')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/event/handler/ConcretePlayerConnectEventHandler.java22
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));
+ }
+}