Fix players being announced on IRC when admins-join-silent is set to true. (Thanks venom983)

This commit is contained in:
UnknownShadow200 2016-02-10 23:36:18 +11:00
parent fddbd360d9
commit df3ee22bba
2 changed files with 19 additions and 23 deletions

View File

@ -148,7 +148,8 @@ namespace MCGalaxy {
void Player_PlayerConnect(Player p) {
if (!Server.irc || !IsConnected()) return;
if (!Server.guestJoinNotify && p.group.Permission <= LevelPermission.Guest) return;
connection.Sender.PublicMessage(channel, p.name + " joined the game");
if (!p.hidden)
connection.Sender.PublicMessage(channel, p.name + " joined the game");
}
void Listener_OnQuit(UserInfo user, string reason) {

View File

@ -760,15 +760,9 @@ namespace MCGalaxy {
SetPrefix();
playerDb.Dispose();
if (PlayerConnect != null)
PlayerConnect(this);
OnPlayerConnectEvent.Call(this);
if (Server.server_owner != "" && Server.server_owner.ToLower().Equals(name.ToLower())) {
if (color == Group.standard.color)
color = "&c";
if (title == "")
title = "Owner";
if (color == Group.standard.color) color = "&c";
if (title == "") title = "Owner";
SetPrefix();
}
@ -780,8 +774,22 @@ namespace MCGalaxy {
if (!File.Exists("text/login/" + this.name + ".txt"))
CP437Writer.WriteAllText("text/login/" + this.name + ".txt", "joined the server.");
string joinm = "&a+ " + this.FullName + Server.DefaultColor + " " + File.ReadAllText("text/login/" + this.name + ".txt");
if (group.Permission < Server.adminchatperm || !Server.adminsjoinsilent) {
if ((Server.guestJoinNotify && group.Permission <= LevelPermission.Guest) || group.Permission > LevelPermission.Guest) {
PlayerInfo.players.ForEach(p1 => Player.SendMessage(p1, joinm));
}
}
if (group.Permission >= Server.adminchatperm && Server.adminsjoinsilent) {
hidden = true;
adminchat = true;
}
if (PlayerConnect != null)
PlayerConnect(this);
OnPlayerConnectEvent.Call(this);
CheckLoginJailed();
if (Server.agreetorulesonentry) {
if (!File.Exists("ranks/agreed.txt"))
File.WriteAllText("ranks/agreed.txt", "");
@ -792,19 +800,6 @@ namespace MCGalaxy {
}
}
string joinm = "&a+ " + this.FullName + Server.DefaultColor + " " + File.ReadAllText("text/login/" + this.name + ".txt");
if (group.Permission < Server.adminchatperm || Server.adminsjoinsilent == false)
{
if ((Server.guestJoinNotify && group.Permission <= LevelPermission.Guest) || group.Permission > LevelPermission.Guest)
{
PlayerInfo.players.ForEach(p1 => Player.SendMessage(p1, joinm));
}
}
if (group.Permission >= Server.adminchatperm && Server.adminsjoinsilent) {
hidden = true;
adminchat = true;
}
if (Server.verifyadmins && group.Permission >= Server.verifyadminsrank) {
if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + this.name + ".dat"))
SendMessage("&cPlease set your admin verification password with &a/setpass [Password]!");