From cae71552cdabc4cd1ce3f9736d59de4caadac434 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 22 Jan 2013 13:21:04 +1100 Subject: [PATCH] Fix permissions and stuff, we are go for master! --- proxy/src/main/java/net/md_5/bungee/ServerConnection.java | 2 ++ proxy/src/main/java/net/md_5/bungee/UserConnection.java | 5 +++++ .../main/java/net/md_5/bungee/command/CommandServer.java | 2 +- proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java | 6 ++++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java index 57994e552..54db34e35 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java @@ -9,6 +9,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import javax.crypto.SecretKey; import lombok.Getter; import net.md_5.bungee.api.Callback; +import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ServerPing; import net.md_5.bungee.api.config.ServerInfo; @@ -101,6 +102,7 @@ public class ServerConnection extends GenericConnection implements Server ServerInfo def = ProxyServer.getInstance().getServers().get(user.getPendingConnection().getListener().getDefaultServer()); if (retry && !info.equals(def)) { + user.sendMessage(ChatColor.RED + "Could not connect to target server, you have been moved to the default server"); return connect(user, def, handshake, false); } else { diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 5b893456a..32a2c154e 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -61,6 +61,11 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer name = handshake.username; displayName = handshake.username; this.loginPackets = loginPackets; + Collection g = ProxyServer.getInstance().getConfigurationAdapter().getGroups(name); + for (String s : g) + { + addGroups(s); + } } @Override diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java b/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java index 29d5e5ecc..1c518efca 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java @@ -44,7 +44,7 @@ public class CommandServer extends Command if (server == null) { player.sendMessage(ChatColor.RED + "The specified server does not exist"); - } else if (server == player.getServer()) + } else if (server.equals(player.getServer().getInfo())) { player.sendMessage(ChatColor.RED + "You are already on this server."); } else diff --git a/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java b/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java index d288ee80f..a3da837ec 100644 --- a/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java +++ b/proxy/src/main/java/net/md_5/bungee/config/YamlConfig.java @@ -11,7 +11,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; import net.md_5.bungee.Util; @@ -191,7 +190,10 @@ public class YamlConfig implements ConfigurationAdapter @SuppressWarnings("unchecked") public Collection getGroups(String player) { - return get("groups." + player, Collections.singleton("default")); + Collection groups = get("groups." + player, Collections.EMPTY_LIST); + Collection ret = new HashSet<>(groups); + ret.add("default"); + return ret; } @Override