* Tweak our CommandSender.

* In lieu of running the plugin and causing confusion, give them an RuntimeException.
This commit is contained in:
Tux 2013-12-06 21:42:03 -05:00
parent 7c35aad456
commit 3925c3a313
2 changed files with 7 additions and 5 deletions

View File

@ -130,6 +130,8 @@ public class RedisBungee extends Plugin implements Listener {
loadConfig();
} catch (IOException e) {
e.printStackTrace();
} catch (JedisConnectionException e) {
throw new RuntimeException("Unable to connect to your Redis server!", e);
}
if (pool != null) {
Jedis tmpRsc = pool.getResource();
@ -184,7 +186,7 @@ public class RedisBungee extends Plugin implements Listener {
}
}
private void loadConfig() throws IOException {
private void loadConfig() throws IOException, JedisConnectionException {
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
}
@ -261,10 +263,10 @@ public class RedisBungee extends Plugin implements Listener {
} catch (JedisConnectionException e) {
if (rsc != null)
pool.returnBrokenResource(rsc);
getLogger().log(Level.WARNING, "Failed to connect to your Redis server! RedisBungee will still work, albeit with reduced functionality.", e);
pool.destroy();
pool = null;
rsc = null;
throw e;
} finally {
if (rsc != null && pool != null) {
pool.returnResource(rsc);

View File

@ -9,9 +9,9 @@ package com.imaginarycode.minecraft.redisbungee;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import java.util.Collection;
import java.util.Collections;
/**
* This class is the CommandSender that RedisBungee uses to dispatch commands to BungeeCord.
@ -40,7 +40,7 @@ public class RedisBungeeCommandSender implements CommandSender {
@Override
public Collection<String> getGroups() {
return ProxyServer.getInstance().getConsole().getGroups();
return Collections.emptySet();
}
@Override
@ -55,7 +55,7 @@ public class RedisBungeeCommandSender implements CommandSender {
@Override
public boolean hasPermission(String s) {
return ProxyServer.getInstance().getConsole().hasPermission(s);
return true;
}
@Override