mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 12:18:01 +00:00
move PlayerUtils and change the name
This commit is contained in:
parent
92f5e04edf
commit
81a8fd218e
@ -1,6 +1,6 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.api.tasks;
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.api.GenericPlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.player.PlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisCluster;
|
||||
@ -9,9 +9,7 @@ import redis.clients.jedis.Pipeline;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public abstract class IntegrityCheckTask extends RedisTask<Void> {
|
||||
|
||||
@ -37,7 +35,7 @@ public abstract class IntegrityCheckTask extends RedisTask<Void> {
|
||||
if (!laggedPlayers.isEmpty()) {
|
||||
plugin.logInfo("Cleaning up lagged proxy " + s + " (" + laggedPlayers.size() + " players)...");
|
||||
for (String laggedPlayer : laggedPlayers) {
|
||||
GenericPlayerUtils.cleanUpPlayer(laggedPlayer, jedis, true);
|
||||
PlayerUtils.cleanUpPlayer(laggedPlayer, jedis, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,7 +56,7 @@ public abstract class IntegrityCheckTask extends RedisTask<Void> {
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
GenericPlayerUtils.cleanUpPlayer(member, jedis, false);
|
||||
PlayerUtils.cleanUpPlayer(member, jedis, false);
|
||||
plugin.logWarn("Player found in set that was not found locally and globally: " + member);
|
||||
} else {
|
||||
jedis.srem("proxy:" + plugin.getConfiguration().getProxyId() + ":usersOnline", member);
|
||||
@ -96,7 +94,7 @@ public abstract class IntegrityCheckTask extends RedisTask<Void> {
|
||||
if (!laggedPlayers.isEmpty()) {
|
||||
plugin.logInfo("Cleaning up lagged proxy " + s + " (" + laggedPlayers.size() + " players)...");
|
||||
for (String laggedPlayer : laggedPlayers) {
|
||||
GenericPlayerUtils.cleanUpPlayer(laggedPlayer, jedisCluster, true);
|
||||
PlayerUtils.cleanUpPlayer(laggedPlayer, jedisCluster, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,7 +115,7 @@ public abstract class IntegrityCheckTask extends RedisTask<Void> {
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
GenericPlayerUtils.cleanUpPlayer(member, jedisCluster, false);
|
||||
PlayerUtils.cleanUpPlayer(member, jedisCluster, false);
|
||||
plugin.logWarn("Player found in set that was not found locally and globally: " + member);
|
||||
} else {
|
||||
jedisCluster.srem("proxy:" + plugin.getConfiguration().getProxyId() + ":usersOnline", member);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.api.tasks;
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.api.GenericPlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.player.PlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisCluster;
|
||||
@ -17,7 +17,7 @@ public class ShutdownUtils {
|
||||
if (jedis.scard("proxy:" + plugin.getConfiguration().getProxyId() + ":usersOnline") > 0) {
|
||||
Set<String> players = jedis.smembers("proxy:" + plugin.getConfiguration().getProxyId() + ":usersOnline");
|
||||
for (String member : players)
|
||||
GenericPlayerUtils.cleanUpPlayer(member, jedis, true);
|
||||
PlayerUtils.cleanUpPlayer(member, jedis, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -28,7 +28,7 @@ public class ShutdownUtils {
|
||||
if (jedisCluster.scard("proxy:" + plugin.getConfiguration().getProxyId() + ":usersOnline") > 0) {
|
||||
Set<String> players = jedisCluster.smembers("proxy:" + plugin.getConfiguration().getProxyId() + ":usersOnline");
|
||||
for (String member : players)
|
||||
GenericPlayerUtils.cleanUpPlayer(member, jedisCluster, true);
|
||||
PlayerUtils.cleanUpPlayer(member, jedisCluster, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.api;
|
||||
package com.imaginarycode.minecraft.redisbungee.api.util.player;
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI;
|
||||
import redis.clients.jedis.Jedis;
|
||||
@ -7,7 +7,7 @@ import redis.clients.jedis.Pipeline;
|
||||
|
||||
import static com.imaginarycode.minecraft.redisbungee.api.util.payload.PayloadUtils.playerQuitPayload;
|
||||
|
||||
public class GenericPlayerUtils {
|
||||
public class PlayerUtils {
|
||||
|
||||
|
||||
public static void cleanUpPlayer(String uuid, Jedis rsc, boolean firePayload) {
|
@ -7,7 +7,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.AbstractRedisBungeeListener;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.GenericPlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.player.PlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.tasks.RedisTask;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.payload.PayloadUtils;
|
||||
@ -144,7 +144,7 @@ public class RedisBungeeBungeeListener extends AbstractRedisBungeeListener<Login
|
||||
@Override
|
||||
public Void jedisTask(Jedis jedis) {
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
GenericPlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), pipeline, true);
|
||||
PlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), pipeline, true);
|
||||
pipeline.sync();
|
||||
return null;
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class RedisBungeeBungeeListener extends AbstractRedisBungeeListener<Login
|
||||
@Override
|
||||
public Void clusterJedisTask(JedisCluster jedisCluster) {
|
||||
// Due some reason JedisCluster does not support pipeline, use instance instead
|
||||
GenericPlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), jedisCluster, true);
|
||||
PlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), jedisCluster, true);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@ -7,7 +7,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.AbstractRedisBungeeListener;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.GenericPlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.player.PlayerUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.tasks.RedisTask;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.payload.PayloadUtils;
|
||||
@ -138,14 +138,14 @@ public class RedisBungeeVelocityListener extends AbstractRedisBungeeListener<Log
|
||||
@Override
|
||||
public Void jedisTask(Jedis jedis) {
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
GenericPlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), pipeline, true);
|
||||
PlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), pipeline, true);
|
||||
pipeline.sync();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void clusterJedisTask(JedisCluster jedisCluster) {
|
||||
GenericPlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), jedisCluster, true);
|
||||
PlayerUtils.cleanUpPlayer(event.getPlayer().getUniqueId().toString(), jedisCluster, true);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user