mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 12:42:22 -04:00
Only call Group.findPlayerGroup once in Player.Handlers.
This commit is contained in:
parent
b86771c26d
commit
8c35ff76d1
@ -63,21 +63,21 @@ namespace MCGalaxy.Commands.World {
|
||||
if (lvl != null) {
|
||||
return GoToLevel(p, lvl, message);
|
||||
} else if (Server.AutoLoad) {
|
||||
if (!LevelInfo.ExistsOffline(message)) {
|
||||
lvl = LevelInfo.Find(message);
|
||||
if (lvl != null) return GoToLevel(p, lvl, message);
|
||||
List<string> matches = CmdSearch.MatchUnloaded(message);
|
||||
if (matches.Count == 1) return GotoOfflineLevel(p, matches[0]);
|
||||
|
||||
if (matches.Count == 0) {
|
||||
Player.Message(p, "No levels found matching \"" + message + "\".");
|
||||
} else {
|
||||
Player.Message(p, "Level \"" + message + "\" does not exist. Did you mean...");
|
||||
Player.Message(p, matches.Concatenate());
|
||||
}
|
||||
return false;
|
||||
// First try exactly matching unloaded levels
|
||||
if (LevelInfo.ExistsOffline(message))
|
||||
return GotoOfflineLevel(p, message);
|
||||
lvl = LevelInfo.Find(message);
|
||||
if (lvl != null) return GoToLevel(p, lvl, message);
|
||||
List<string> matches = CmdSearch.MatchUnloaded(message);
|
||||
if (matches.Count == 1) return GotoOfflineLevel(p, matches[0]);
|
||||
|
||||
if (matches.Count == 0) {
|
||||
Player.Message(p, "No levels found matching \"" + message + "\".");
|
||||
} else {
|
||||
Player.Message(p, "Level \"" + message + "\" does not exist. Did you mean...");
|
||||
Player.Message(p, matches.Concatenate(", "));
|
||||
}
|
||||
return GotoOfflineLevel(p, message);
|
||||
return false;
|
||||
} else {
|
||||
lvl = LevelInfo.Find(message);
|
||||
if (lvl == null) {
|
||||
|
@ -321,6 +321,7 @@ namespace MCGalaxy {
|
||||
|
||||
isDev = Server.Devs.CaselessContains(name);
|
||||
isMod = Server.Mods.CaselessContains(name);
|
||||
Group foundGrp = Group.findPlayerGroup(name);
|
||||
|
||||
try {
|
||||
Server.TempBan tBan = Server.tempBans.Find(tB => tB.name.ToLower() == name.ToLower());
|
||||
@ -340,7 +341,7 @@ namespace MCGalaxy {
|
||||
Kick(Server.defaultBanMessage, true); return;
|
||||
}
|
||||
|
||||
if (Group.findPlayerGroup(name) == Group.findPerm(LevelPermission.Banned)) {
|
||||
if (foundGrp == Group.findPerm(LevelPermission.Banned)) {
|
||||
if (!Server.useWhitelist || !onWhitelist) {
|
||||
string[] data = Ban.GetBanData(name);
|
||||
if (data != null) {
|
||||
@ -359,7 +360,7 @@ namespace MCGalaxy {
|
||||
Player[] online = PlayerInfo.Online.Items;
|
||||
if (online.Length >= Server.players && !IPInPrivateRange(ip)) { Kick("Server full!"); return; }
|
||||
// Code for limiting no. of guests
|
||||
if (Group.findPlayerGroup(name) == Group.findPerm(LevelPermission.Guest))
|
||||
if (foundGrp == Group.findPerm(LevelPermission.Guest))
|
||||
{
|
||||
// Check to see how many guests we have
|
||||
online = PlayerInfo.Online.Items;
|
||||
@ -397,7 +398,7 @@ namespace MCGalaxy {
|
||||
try { left.Remove(name.ToLower()); }
|
||||
catch { }
|
||||
|
||||
group = Group.findPlayerGroup(name);
|
||||
group = foundGrp;
|
||||
Loading = true;
|
||||
if (disconnected) return;
|
||||
id = FreeId();
|
||||
|
Loading…
x
Reference in New Issue
Block a user