mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-03 16:36:41 +00:00
- Start the indefinite ban system, currently working with manually adding to the configuration.
- /plex reload reloads the indefinite bans - Fixed bug where AdminChat showed up with symbols still and not colorized in adminchat
This commit is contained in:
@ -4,42 +4,12 @@ import dev.plex.PlexBase;
|
||||
import dev.plex.util.PlexLog;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class RedisConnection extends PlexBase
|
||||
{
|
||||
private Jedis jedis;
|
||||
|
||||
/*public JedisPool openPool()
|
||||
{
|
||||
JedisPoolConfig jedisConfig = new JedisPoolConfig();
|
||||
//jedisConfig.setMaxIdle(10);
|
||||
//jedisConfig.setMaxTotal(100);
|
||||
ClassLoader previous = Thread.currentThread().getContextClassLoader();
|
||||
Thread.currentThread().setContextClassLoader(RedisConnection.class.getClassLoader());
|
||||
this.pool = new JedisPool(jedisConfig, plugin.config.getString("data.side.hostname"),
|
||||
plugin.config.getInt("data.side.port"));
|
||||
Thread.currentThread().setContextClassLoader(previous);
|
||||
PlexLog.log("Connected to Redis!");
|
||||
return pool;
|
||||
}
|
||||
|
||||
public Jedis getJedis()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.jedis = pool.getResource();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PlexLog.error("An error occurred with Redis.");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if (plugin.config.getBoolean("data.side.auth"))
|
||||
{
|
||||
jedis.auth(plugin.config.getString("data.side.password"));
|
||||
}
|
||||
return jedis;
|
||||
}*/
|
||||
|
||||
public Jedis getJedis()
|
||||
{
|
||||
try
|
||||
@ -60,6 +30,16 @@ public class RedisConnection extends PlexBase
|
||||
return jedis;
|
||||
}
|
||||
|
||||
public void runAsync(Consumer<Jedis> jedisConsumer)
|
||||
{
|
||||
new Thread(() -> {
|
||||
try (Jedis jedis = getJedis())
|
||||
{
|
||||
jedisConsumer.accept(jedis);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public final boolean isEnabled()
|
||||
{
|
||||
return plugin.config.getBoolean("data.side.enabled");
|
||||
|
Reference in New Issue
Block a user