Minor refactor and fixes.

This commit is contained in:
Tux 2013-12-23 23:42:56 -05:00
parent d079990a3a
commit f240742489
3 changed files with 5 additions and 4 deletions

View File

@ -36,7 +36,6 @@ import java.util.logging.Level;
*/ */
public final class RedisBungee extends Plugin implements Listener { public final class RedisBungee extends Plugin implements Listener {
private static final ServerPing.PlayerInfo[] EMPTY_PLAYERINFO = new ServerPing.PlayerInfo[]{}; private static final ServerPing.PlayerInfo[] EMPTY_PLAYERINFO = new ServerPing.PlayerInfo[]{};
private RedisBungeeCommandSender commandSender = new RedisBungeeCommandSender();
private static Configuration configuration; private static Configuration configuration;
private JedisPool pool; private JedisPool pool;
private RedisBungee plugin; private RedisBungee plugin;
@ -390,7 +389,7 @@ public final class RedisBungee extends Plugin implements Listener {
cmd = s2; cmd = s2;
} }
getLogger().info("Invoking command from PubSub: /" + s2); getLogger().info("Invoking command from PubSub: /" + s2);
getProxy().getPluginManager().dispatchCommand(commandSender, cmd); getProxy().getPluginManager().dispatchCommand(RedisBungeeCommandSender.instance, cmd);
} }
@Override @Override

View File

@ -22,8 +22,10 @@ import java.util.Collections;
* @author tuxed * @author tuxed
* @since 0.2.3 * @since 0.2.3
*/ */
@NoArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class RedisBungeeCommandSender implements CommandSender { public class RedisBungeeCommandSender implements CommandSender {
protected static RedisBungeeCommandSender instance = new RedisBungeeCommandSender();
@Override @Override
public String getName() { public String getName() {
return "RedisBungee"; return "RedisBungee";

View File

@ -47,7 +47,7 @@ public class RedisBungeeCommands {
BaseComponent[] playersOnline = new ComponentBuilder("").color(ChatColor.YELLOW).append(String.valueOf(count)) BaseComponent[] playersOnline = new ComponentBuilder("").color(ChatColor.YELLOW).append(String.valueOf(count))
.append(" player(s) are currently online.").create(); .append(" player(s) are currently online.").create();
if (args.length > 0 && args[0].equals("showall")) { if (args.length > 0 && args[0].equals("showall")) {
if (RedisBungee.getConfiguration().getBoolean("canonical-glist", false)) { if (RedisBungee.getConfiguration().getBoolean("canonical-glist", true)) {
Multimap<String, String> serverToPlayers = HashMultimap.create(); Multimap<String, String> serverToPlayers = HashMultimap.create();
for (String p : RedisBungee.getApi().getPlayersOnline()) { for (String p : RedisBungee.getApi().getPlayersOnline()) {
ServerInfo si = RedisBungee.getApi().getServerFor(p); ServerInfo si = RedisBungee.getApi().getServerFor(p);