mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-12-23 18:48:02 +00:00
* Tweak our CommandSender.
* In lieu of running the plugin and causing confusion, give them an RuntimeException.
This commit is contained in:
parent
7c35aad456
commit
3925c3a313
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user