diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java index 653ffcc..15e86b7 100644 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java +++ b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java @@ -16,6 +16,7 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; import com.google.common.net.InetAddresses; import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent; +import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent; import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent; import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent; import com.imaginarycode.minecraft.redisbungee.api.tasks.RedisPipelineTask; @@ -31,7 +32,7 @@ import java.net.InetAddress; import java.util.*; import java.util.concurrent.TimeUnit; -public abstract class PlayerDataManager { +public abstract class PlayerDataManager { protected final RedisBungeePlugin

plugin; private final Object SERVERS_TO_PLAYERS_KEY = new Object(); @@ -42,6 +43,7 @@ public abstract class PlayerDataManager lastServerCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getLastServerFromRedis); private final LoadingCache proxyCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getProxyFromRedis); private final LoadingCache ipCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getIpAddressFromRedis); + private final LoadingCache lastOnlineCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getLastOnlineFromRedis); private final LoadingCache> serverToPlayersCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).build(this::serversToPlayersBuilder); private final JSONComponentSerializer COMPONENT_SERIALIZER = JSONComponentSerializer.json(); @@ -58,6 +60,8 @@ public abstract class PlayerDataManager serversToPlayers() { diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java index 8dc6887..e0813cc 100644 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java +++ b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java @@ -65,7 +65,7 @@ public interface RedisBungeePlugin

extends EventsPlatform { ProxyDataManager proxyDataManager(); - PlayerDataManager playerDataManager(); + PlayerDataManager playerDataManager(); UUIDTranslator getUuidTranslator(); diff --git a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java index 8b7ff2f..5455731 100644 --- a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java +++ b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java @@ -12,7 +12,9 @@ package com.imaginarycode.minecraft.redisbungee; import com.imaginarycode.minecraft.redisbungee.api.PlayerDataManager; import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; +import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent; import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent; +import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent; import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent; import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent; import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer; @@ -28,7 +30,7 @@ import net.md_5.bungee.event.EventHandler; import java.util.concurrent.TimeUnit; -public class BungeePlayerDataManager extends PlayerDataManager implements Listener { +public class BungeePlayerDataManager extends PlayerDataManager implements Listener { public BungeePlayerDataManager(RedisBungeePlugin plugin) { super(plugin); @@ -44,6 +46,11 @@ public class BungeePlayerDataManager extends PlayerDataManager playerDataManager() { + public PlayerDataManager playerDataManager() { return this.playerDataManager; } diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java index 103dcef..473b39c 100644 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java +++ b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java @@ -143,7 +143,7 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin, Con } @Override - public PlayerDataManager playerDataManager() { + public PlayerDataManager playerDataManager() { return this.playerDataManager; } diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java index ceb998c..cb4fc86 100644 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java +++ b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java @@ -14,6 +14,7 @@ import com.imaginarycode.minecraft.redisbungee.api.PlayerDataManager; import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; import com.imaginarycode.minecraft.redisbungee.api.config.RedisBungeeConfiguration; import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent; +import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent; import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent; import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent; import com.velocitypowered.api.event.Continuation; @@ -28,7 +29,7 @@ import net.kyori.adventure.text.Component; import java.util.concurrent.TimeUnit; -public class VelocityPlayerDataManager extends PlayerDataManager { +public class VelocityPlayerDataManager extends PlayerDataManager { public VelocityPlayerDataManager(RedisBungeePlugin plugin) { super(plugin); } @@ -43,6 +44,11 @@ public class VelocityPlayerDataManager extends PlayerDataManager