mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2025-04-20 01:27:07 +00:00
cleanup InitialUtils class and change how some logs are sent
This commit is contained in:
parent
7df33e3e6a
commit
eac00e1cd2
@ -12,8 +12,6 @@ package com.imaginarycode.minecraft.redisbungee.api.tasks;
|
|||||||
|
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.util.RedisUtil;
|
import com.imaginarycode.minecraft.redisbungee.api.util.RedisUtil;
|
||||||
import redis.clients.jedis.Jedis;
|
|
||||||
import redis.clients.jedis.JedisCluster;
|
|
||||||
import redis.clients.jedis.Protocol;
|
import redis.clients.jedis.Protocol;
|
||||||
import redis.clients.jedis.UnifiedJedis;
|
import redis.clients.jedis.UnifiedJedis;
|
||||||
|
|
||||||
@ -28,12 +26,11 @@ public class InitialUtils {
|
|||||||
@Override
|
@Override
|
||||||
public Void unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
public Void unifiedJedisTask(UnifiedJedis unifiedJedis) {
|
||||||
// This is more portable than INFO <section>
|
// This is more portable than INFO <section>
|
||||||
|
|
||||||
String info = new String((byte[]) unifiedJedis.sendCommand(Protocol.Command.INFO));
|
String info = new String((byte[]) unifiedJedis.sendCommand(Protocol.Command.INFO));
|
||||||
for (String s : info.split("\r\n")) {
|
for (String s : info.split("\r\n")) {
|
||||||
if (s.startsWith("redis_version:")) {
|
if (s.startsWith("redis_version:")) {
|
||||||
String version = s.split(":")[1];
|
String version = s.split(":")[1];
|
||||||
plugin.logInfo(version + " <- redis version");
|
plugin.logInfo("Redis server version: " + version);
|
||||||
if (!RedisUtil.isRedisVersionRight(version)) {
|
if (!RedisUtil.isRedisVersionRight(version)) {
|
||||||
plugin.logFatal("Your version of Redis (" + version + ") is not at least version 3.0 RedisBungee requires a newer version of Redis.");
|
plugin.logFatal("Your version of Redis (" + version + ") is not at least version 3.0 RedisBungee requires a newer version of Redis.");
|
||||||
throw new RuntimeException("Unsupported Redis version detected");
|
throw new RuntimeException("Unsupported Redis version detected");
|
||||||
@ -62,7 +59,7 @@ public class InitialUtils {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
plugin.logInfo("crash file was deleted");
|
plugin.logInfo("crash file was deleted continuing RedisBungee startup ");
|
||||||
} else if (unifiedJedis.hexists("heartbeats", plugin.getConfiguration().getProxyId())) {
|
} else if (unifiedJedis.hexists("heartbeats", plugin.getConfiguration().getProxyId())) {
|
||||||
try {
|
try {
|
||||||
long value = Long.parseLong(unifiedJedis.hget("heartbeats", plugin.getConfiguration().getProxyId()));
|
long value = Long.parseLong(unifiedJedis.hget("heartbeats", plugin.getConfiguration().getProxyId()));
|
||||||
|
Loading…
Reference in New Issue
Block a user