Player nicks show in tab list. Clicking on names in tab list still adds their original username to chat input.

This commit is contained in:
UnknownShadow200 2018-12-26 00:15:51 +11:00
parent c17e37315e
commit abb56f8867
4 changed files with 11 additions and 7 deletions

View File

@ -43,7 +43,8 @@ namespace MCGalaxy.Commands.Chatting {
} else if (action == "titles") {
Toggle(p, ref p.Ignores.Titles, "{1}Player titles {0} show before names in chat"); return;
} else if (action == "nicks") {
Toggle(p, ref p.Ignores.Nicks, "{1}Custom player nicks {0} show in chat"); return;
Toggle(p, ref p.Ignores.Nicks, "{1}Custom player nicks {0} show in chat");
TabList.Update(p, true); return;
} else if (action == "8ball") {
Toggle(p, ref p.Ignores.EightBall, "{0} ignoring %T/8ball"); return;
} else if (action == "drawoutput") {

View File

@ -66,7 +66,9 @@ namespace MCGalaxy.Commands.Chatting {
Chat.MessageFrom(who, "λNICK %Shad their nick set to " + who.color + nick);
who.DisplayName = nick;
}
PlayerDB.Save(who);
TabList.Update(who, true);
}
public override void Help(Player p) {

View File

@ -36,6 +36,7 @@ namespace MCGalaxy {
string name, group;
GetEntry(p, dst, out name, out group);
name = Colors.Escape(name); // for nicks
name = Colors.Cleanup(name, dst.hasTextColors);
group = Colors.Cleanup(group, dst.hasTextColors);
dst.Send(Packet.ExtAddPlayerName(id, p.truename, name, group, grpPerm, dst.hasCP437));
@ -43,7 +44,7 @@ namespace MCGalaxy {
static void GetEntry(Player p, Player dst, out string name, out string group) {
group = Server.Config.TablistGlobal ? "On " + p.level.name : "&fPlayers";
name = p.color + p.truename;
name = dst.Ignores.Nicks ? p.color + p.truename : p.ColoredName;
OnTabListEntryAddedEvent.Call(p, ref name, ref group, dst);
if (p.hidden && p.IsAfk) { name += " &f(Hid, &7AFK)"; return; }
@ -57,7 +58,7 @@ namespace MCGalaxy {
string name = b.color + b.name, group = "Bots";
OnTabListEntryAddedEvent.Call(b, ref name, ref group, dst);
dst.Send(Packet.ExtAddPlayerName(b.id, b.SkinName, name, group, 0, dst.hasCP437));
dst.Send(Packet.ExtAddPlayerName(b.id, b.name, name, group, 0, dst.hasCP437));
}
/// <summary> Removes the given player from player's tab list (if their client supports it). </summary>
@ -88,7 +89,7 @@ namespace MCGalaxy {
}
}
/// <summary> Updates the tab list entry for this player to all other players
/// <summary> Removes this tab list entry for this player to all other players
/// (whose clients support it) in the server. </summary>
internal static void RemoveAll(Player p, bool self, bool toVisible) {
if (!Server.Config.TablistGlobal) return;