mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-05 00:56:42 +00:00
Removed deprecated methods from custom world and fixed a missing Jedis check
This commit is contained in:
@ -175,28 +175,31 @@ public class PunishmentManager extends PlexBase
|
||||
public List<Punishment> getActiveBans()
|
||||
{
|
||||
List<Punishment> punishments = Lists.newArrayList();
|
||||
Jedis jedis = Plex.get().getRedisConnection().getJedis();
|
||||
jedis.keys("*").forEach(key ->
|
||||
{
|
||||
try
|
||||
{
|
||||
UUID uuid = UUID.fromString(key);
|
||||
String jsonPunishmentString = jedis.get(uuid.toString());
|
||||
JSONObject object = new JSONObject(jsonPunishmentString);
|
||||
object.getJSONObject(uuid.toString()).getJSONArray("punishments").forEach(json ->
|
||||
{
|
||||
Punishment punishment = Punishment.fromJson(json.toString());
|
||||
if (punishment.isActive() && punishment.getType() == PunishmentType.BAN)
|
||||
{
|
||||
punishments.add(punishment);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IllegalArgumentException ignored)
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
if (Plex.get().getRedisConnection().isEnabled())
|
||||
{
|
||||
Jedis jedis = Plex.get().getRedisConnection().getJedis();
|
||||
jedis.keys("*").forEach(key ->
|
||||
{
|
||||
try
|
||||
{
|
||||
UUID uuid = UUID.fromString(key);
|
||||
String jsonPunishmentString = jedis.get(uuid.toString());
|
||||
JSONObject object = new JSONObject(jsonPunishmentString);
|
||||
object.getJSONObject(uuid.toString()).getJSONArray("punishments").forEach(json ->
|
||||
{
|
||||
Punishment punishment = Punishment.fromJson(json.toString());
|
||||
if (punishment.isActive() && punishment.getType() == PunishmentType.BAN)
|
||||
{
|
||||
punishments.add(punishment);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IllegalArgumentException ignored)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return punishments;
|
||||
}
|
||||
|
Reference in New Issue
Block a user