diff --git a/Commands/Chat/CmdIgnore.cs b/Commands/Chat/CmdIgnore.cs
index 98e04b14a..a04c0ed2d 100644
--- a/Commands/Chat/CmdIgnore.cs
+++ b/Commands/Chat/CmdIgnore.cs
@@ -67,7 +67,7 @@ namespace MCGalaxy.Commands {
if (unignore != null) {
p.listignored.Remove(unignore);
- Player.Message(p, "No longer ignoring &a{0}", unignore);
+ Player.Message(p, "&aNo longer ignoring {0}", unignore);
} else {
int matches = 0;
Player who = PlayerInfo.FindOrShowMatches(p, action);
@@ -80,10 +80,10 @@ namespace MCGalaxy.Commands {
if (p.listignored.Contains(who.name)) {
p.listignored.Remove(who.name);
- Player.Message(p, "No longer ignoring &a{0}", who.DisplayName);
+ Player.Message(p, "&aNo longer ignoring {0}", who.ColoredName);
} else {
p.listignored.Add(who.name);
- Player.Message(p, "Now ignoring &c{0}", who.DisplayName);
+ Player.Message(p, "&cNow ignoring {0}", who.ColoredName);
}
}
}
diff --git a/Commands/Information/CmdPlayers.cs b/Commands/Information/CmdPlayers.cs
index 9054d2591..0dbd88302 100644
--- a/Commands/Information/CmdPlayers.cs
+++ b/Commands/Information/CmdPlayers.cs
@@ -101,9 +101,9 @@ namespace MCGalaxy.Commands
}
static void AddStates(Player pl, ref string name) {
- if (pl.hidden) name += "(hidden)";
- if (pl.muted) name += "(muted)";
- if (pl.frozen) name += "(frozen)";
+ if (pl.hidden) name += "-hidden";
+ if (pl.muted) name += "-muted";
+ if (pl.frozen) name += "-freeze";
if (pl.Game.Referee) name += "-ref";
if (pl.IsAfk) name += "-afk";
}
diff --git a/Commands/Moderation/CmdHide.cs b/Commands/Moderation/CmdHide.cs
index 0a8c5689c..352e8ba4a 100644
--- a/Commands/Moderation/CmdHide.cs
+++ b/Commands/Moderation/CmdHide.cs
@@ -67,10 +67,12 @@ namespace MCGalaxy.Commands
Player.SendChatFrom(p, "&c- " + p.FullName + " %S" + discMsg, false);
Server.IRC.Say(p.DisplayName + " left the game (" + discMsg + ")");
if (messageOps && !p.opchat) opchat.Use(p, message);
+ Server.Hidden.Append(p.name);
} else {
Entities.GlobalSpawn(p, false);
p.hidden = false;
p.otherRankHidden = false;
+ p.oHideRank = LevelPermission.Null;
if (messageOps)
Chat.GlobalMessageAdmins("To Admins -" + p.ColoredName + "%S- is now &fvisible%S.");
@@ -78,6 +80,7 @@ namespace MCGalaxy.Commands
Server.IRC.Say(p.DisplayName + " joined the game");
if (messageOps && p.opchat) opchat.Use(p, message);
if (p.adminchat) adminchat.Use(p, message);
+ Server.Hidden.DeleteStartsWith(p.name);
}
}
diff --git a/Player/Entities.cs b/Player/Entities.cs
index 2dae12e5d..76dc0dc4e 100644
--- a/Player/Entities.cs
+++ b/Player/Entities.cs
@@ -161,23 +161,23 @@ namespace MCGalaxy {
/// Returns whether the given player is able to see the other player (e.g. in /who).
- public static bool CanSee(Player p, Player who) {
- if (p == null || !who.hidden || p == who) return true;
- if (who.otherRankHidden) return p.group.Permission >= who.oHideRank;
- return p.group.Permission > who.group.Permission;
+ public static bool CanSee(Player p, Player target) {
+ if (p == null || !target.hidden || p == target) return true;
+ if (target.otherRankHidden) return p.group.Permission >= target.oHideRank;
+ return p.group.Permission > target.group.Permission;
}
/// Returns whether the given player is able to see the other player as an in-game entity.
- public static bool CanSeeEntity(Player p, Player who) {
- bool mayBeHidden = who.hidden;
- mayBeHidden |= (who.Game.Referee || who.Game.Invisible) && Server.zombie.Running;
- if (p == null || !mayBeHidden || p == who) return true;
- if (who.Game.Referee && !p.Game.Referee
+ public static bool CanSeeEntity(Player p, Player target) {
+ bool mayBeHidden = target.hidden;
+ mayBeHidden |= (target.Game.Referee || target.Game.Invisible) && Server.zombie.Running;
+ if (p == null || !mayBeHidden || p == target) return true;
+ if (target.Game.Referee && !p.Game.Referee
&& Server.zombie.Running) return false;
- if (who.Game.Invisible && !p.Game.Referee
+ if (target.Game.Invisible && !p.Game.Referee
&& Server.zombie.Running) return false;
- if (who.otherRankHidden) return p.group.Permission >= who.oHideRank;
- return p.group.Permission >= who.group.Permission;
+ if (target.otherRankHidden) return p.group.Permission >= target.oHideRank;
+ return p.group.Permission >= target.group.Permission;
}
/// Updates the model of the entity with the specified id to all other players.
diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs
index dd4467647..739686ab8 100644
--- a/Player/Player.Handlers.cs
+++ b/Player/Player.Handlers.cs
@@ -531,16 +531,20 @@ namespace MCGalaxy {
adminpen = true;
if (emoteList.Contains(name)) parseSmiley = false;
- string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this);
- if (group.Permission < Server.adminchatperm || !Server.adminsjoinsilent) {
- if ((Server.guestJoinNotify && group.Permission <= LevelPermission.Guest) || group.Permission > LevelPermission.Guest) {
- Player[] players = PlayerInfo.Online.Items;
- foreach (Player pl in players) { Player.Message(pl, joinm); }
- }
- }
+ hidden = group.CanExecute("hide") && Server.Hidden.Find(name).FirstOrDefault() != null;
+ if (hidden) SendMessage("&8Reminder: You are still hidden.");
if (group.Permission >= Server.adminchatperm && Server.adminsjoinsilent) {
- hidden = true;
- adminchat = true;
+ hidden = true; adminchat = true;
+ }
+
+ string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this);
+ if (hidden) joinm = "&8(hidden)" + joinm;
+ const LevelPermission perm = LevelPermission.Guest;
+ if (group.Permission > perm || (Server.guestJoinNotify && group.Permission <= perm)) {
+ Player[] players = PlayerInfo.Online.Items;
+ foreach (Player pl in players) {
+ if (Entities.CanSee(pl, this)) Player.Message(pl, joinm);
+ }
}
if (PlayerConnect != null)
diff --git a/Player/Player.cs b/Player/Player.cs
index 2177bf1ee..a0fae3724 100644
--- a/Player/Player.cs
+++ b/Player/Player.cs
@@ -97,7 +97,7 @@ namespace MCGalaxy {
public string ip;
public string color;
public Group group;
- public LevelPermission oHideRank;
+ public LevelPermission oHideRank = LevelPermission.Null;
public bool otherRankHidden = false;
public bool hidden = false;
public bool painting = false;
@@ -591,14 +591,15 @@ namespace MCGalaxy {
Entities.DespawnEntities(this, false);
if (discMsg != null) {
- if (!hidden) {
- string leavem = "&c- " + FullName + " %S" + discMsg;
- if ((Server.guestLeaveNotify && group.Permission <= LevelPermission.Guest) || group.Permission > LevelPermission.Guest) {
- Player[] players = PlayerInfo.Online.Items;
- foreach (Player pl in players) { Player.Message(pl, leavem); }
- }
- }
- Server.s.Log(name + " disconnected (" + discMsg + ").");
+ string leavem = "&c- " + FullName + " %S" + discMsg;
+ const LevelPermission perm = LevelPermission.Guest;
+ if (group.Permission > perm || (Server.guestLeaveNotify && group.Permission <= perm)) {
+ Player[] players = PlayerInfo.Online.Items;
+ foreach (Player pl in players) {
+ if (Entities.CanSee(pl, this)) Player.Message(pl, leavem);
+ }
+ }
+ Server.s.Log(name + " disconnected (" + discMsg + ").");
} else {
totalKicked++;
SendChatFrom(this, "&c- " + color + prefix + DisplayName + " %Skicked (" + kickMsg + "%S).", false);
diff --git a/Player/PlayersFile.cs b/Player/PlayersFile.cs
index d8d9946ec..6674597a9 100644
--- a/Player/PlayersFile.cs
+++ b/Player/PlayersFile.cs
@@ -57,11 +57,11 @@ namespace MCGalaxy {
}
}
WriteLines(lines);
- }
+ }
/// Deletes all lines which contain the given value.
public void DeleteContains(string value) {
- if (!File.Exists(file)) return;
+ if (!File.Exists(file)) return;
List lines = new List();
using (StreamReader r = new StreamReader(file)) {
string line;
diff --git a/Server/Server.cs b/Server/Server.cs
index 865e2884a..a1a1b8d4e 100644
--- a/Server/Server.cs
+++ b/Server/Server.cs
@@ -83,6 +83,7 @@ namespace MCGalaxy
public static PlayersFile Jailed = new PlayersFile("ranks/jailed.txt");
public static PlayersFile TempRanks = new PlayersFile("text/tempranks.txt");
public static PlayersFile Notes = new PlayersFile("text/notes.txt");
+ public static PlayersFile Hidden = new PlayersFile("ranks/hidden.txt");
public static PlayersFile Skins = new PlayersFile("extra/skins.txt");
public static PlayersFile Models = new PlayersFile("extra/models.txt");
public static Version Version { get { return System.Reflection.Assembly.GetAssembly(typeof(Server)).GetName().Version; } }