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