Check if error will occure when redis fails

This commit is contained in:
ham1255
2020-05-10 21:44:10 +04:00
parent 2ca77d1007
commit d82f7f4bd8
7 changed files with 92 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ import org.bukkit.ChatColor;
import org.bukkit.event.Event;
import org.json.JSONObject;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.exceptions.JedisConnectionException;
public class EffSendMessage extends Effect {
//"hi"
@@ -34,7 +35,11 @@ public class EffSendMessage extends Effect {
return;
}
plugin.getJedisExecutionService().execute(() -> {
Jedis j = plugin.getJedisPool().getResource();
Jedis j;
try {j = plugin.getJedisPool().getResource();}catch (JedisConnectionException e){
Bukkit.broadcastMessage("Redis is down!!! dont send messages");
return;
}
JSONObject json = new JSONObject();
try {
json.put("Message", message);