mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-29 14:56:43 +00:00
That's right, Redis is working!
- Fix end date for bans not being correct - Add a lot of debug information - Add ban reasons
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
package dev.plex.storage;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.PlexBase;
|
||||
import dev.plex.util.PlexLog;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
public class RedisConnection
|
||||
public class RedisConnection extends PlexBase
|
||||
{
|
||||
private JedisPool pool;
|
||||
private Jedis jedis;
|
||||
@ -14,19 +15,24 @@ public class RedisConnection
|
||||
{
|
||||
ClassLoader previous = Thread.currentThread().getContextClassLoader();
|
||||
Thread.currentThread().setContextClassLoader(RedisConnection.class.getClassLoader());
|
||||
this.pool = new JedisPool(new JedisPoolConfig(), Plex.get().getConfig().getString("data.side.hostname"), Plex.get().getConfig().getInt("data.side.port"));
|
||||
this.pool = new JedisPool(plugin.config.getString("data.side.hostname"), Plex.get().getConfig().getInt("data.side.port"));
|
||||
Thread.currentThread().setContextClassLoader(previous);
|
||||
PlexLog.log("Connected to Redis!");
|
||||
return pool;
|
||||
}
|
||||
|
||||
public Jedis getJedis()
|
||||
{
|
||||
this.jedis = pool.getResource();
|
||||
if (Plex.get().getConfig().getBoolean("data.side.auth"))
|
||||
if (plugin.config.getBoolean("data.side.auth"))
|
||||
{
|
||||
jedis.auth(Plex.get().getConfig().getString("data.side.password"));
|
||||
jedis.auth(plugin.config.getString("data.side.password"));
|
||||
}
|
||||
return jedis;
|
||||
}
|
||||
|
||||
public final boolean isEnabled()
|
||||
{
|
||||
return plugin.config.getBoolean("data.side.enabled");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user