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 9aebbd2..94c1ed9 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; @@ -34,7 +35,7 @@ import java.util.Set; import java.util.UUID; 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(); @@ -45,6 +46,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(); @@ -61,6 +63,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 0a5dfbf..5991882 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.Component; @@ -29,7 +31,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); @@ -47,6 +49,12 @@ 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 0a1ffe0..152c912 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 @@ -151,7 +151,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 b3bcff6..0f4f3f7 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); } @@ -45,6 +46,12 @@ public class VelocityPlayerDataManager extends PlayerDataManager