diff --git a/Commands/Chat/CmdChatRoom.cs b/Commands/Chat/CmdChatRoom.cs index 53a0feee4..23241d417 100644 --- a/Commands/Chat/CmdChatRoom.cs +++ b/Commands/Chat/CmdChatRoom.cs @@ -229,10 +229,9 @@ namespace MCGalaxy.Commands { pl.spyChatRooms.Remove(room); } Player.SendMessage(pl, "You've been forced to join the chat room '" + room + "'"); - Chat.ChatRoom(pl, pl.color + pl.name + Server.DefaultColor + " has force joined your chat room", false, room); + Chat.ChatRoom(pl, pl.FullName + " %Shas force joined your chat room", false, room); pl.Chatroom = room; - Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + - " was forced to join the chatroom '" + room + "' by you"); + Player.SendMessage(p, pl.FullName + " %Swas forced to join the chatroom '" + room + "' by you"); } void HandleKick(Player p, string[] parts) { diff --git a/Commands/Economy/CmdFakePay.cs b/Commands/Economy/CmdFakePay.cs index 9649930ee..260f8c158 100644 --- a/Commands/Economy/CmdFakePay.cs +++ b/Commands/Economy/CmdFakePay.cs @@ -39,7 +39,7 @@ namespace MCGalaxy.Commands { if (amount < 0) { Player.SendMessage(p, "You can't fakepay a negative amount."); return; } if (amount >= 16777215) { Player.SendMessage(p, "You can only fakepay up to 16777215."); return; } - Player.GlobalMessage(who.color + who.prefix + who.DisplayName + " %Swas given " + amount + " " + Server.moneys); + Player.GlobalMessage(who.FullName + " %Swas given " + amount + " " + Server.moneys); } public override void Help(Player p) { diff --git a/Commands/Economy/CmdGive.cs b/Commands/Economy/CmdGive.cs index ca0b5a010..2120d3bbc 100644 --- a/Commands/Economy/CmdGive.cs +++ b/Commands/Economy/CmdGive.cs @@ -84,7 +84,7 @@ namespace MCGalaxy.Commands ecos.money = who.money; ecos.salary = "%f" + amountGiven + "%3 " + Server.moneys + " by " + user1 + "%3 on %f" + DateTime.Now.ToString(CultureInfo.InvariantCulture); Economy.UpdateEcoStats(ecos); - Player.GlobalMessage(user2 + Server.DefaultColor + " gave " + who.prefix + who.name + " %f" + amountGiven + " %3" + Server.moneys); + Player.GlobalMessage(user2 + " %Sgave " + who.FullName + " %f" + amountGiven + " %3" + Server.moneys); //Player.GlobalMessage(who.color + who.prefix + who.name + Server.DefaultColor + " was given %f" + amountGiven + " %3" + Server.moneys + Server.DefaultColor + " by " + user2); } public override void Help(Player p) diff --git a/Commands/Economy/CmdPay.cs b/Commands/Economy/CmdPay.cs index 6d61774d1..5b2ba1a82 100644 --- a/Commands/Economy/CmdPay.cs +++ b/Commands/Economy/CmdPay.cs @@ -62,7 +62,7 @@ namespace MCGalaxy.Commands Economy.UpdateEcoStats(payer); Economy.UpdateEcoStats(receiver); - Player.GlobalMessage(p.prefix + p.DisplayName + Server.DefaultColor + " paid %f" + off.color + off.name + Server.DefaultColor + "(offline) %f" + amountPaid + " %3" + Server.moneys); + Player.GlobalMessage(p.FullName + " %Spaid %f" + off.color + off.name + "%S(offline) %f" + amountPaid + " %3" + Server.moneys); return; } if (who == p) { Player.SendMessage(p, "%cYou can't pay yourself %3" + Server.moneys); return; } @@ -82,7 +82,7 @@ namespace MCGalaxy.Commands Economy.UpdateEcoStats(payer); Economy.UpdateEcoStats(receiver); - Player.GlobalMessage(p.prefix + p.DisplayName + Server.DefaultColor + " paid " + who.prefix + who.name + " %f" + amountPaid + " %3" + Server.moneys); + Player.GlobalMessage(p.FullName + " %Spaid " + who.FullName + " %f" + amountPaid + " %3" + Server.moneys); } public override void Help(Player p) { diff --git a/Commands/Information/CmdWhois.cs b/Commands/Information/CmdWhois.cs index 5d65c3722..378ece27d 100644 --- a/Commands/Information/CmdWhois.cs +++ b/Commands/Information/CmdWhois.cs @@ -37,8 +37,8 @@ namespace MCGalaxy.Commands Command.all.Find("whowas").Use(p, message); return; } - Player.SendMessage(p, who.color + who.name + Server.DefaultColor + " (" + who.DisplayName + ") " + Server.DefaultColor + " is on &b" + who.level.name); - Player.SendMessage(p, who.color + who.prefix + who.name + Server.DefaultColor + " has :"); + Player.SendMessage(p, who.color + who.name + " %S(" + who.DisplayName + ") %Sis on &b" + who.level.name); + Player.SendMessage(p, who.FullName + Server.DefaultColor + " %Shas :"); Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name); Group nobody = Group.findPerm(LevelPermission.Nobody); diff --git a/Commands/other/CmdNick.cs b/Commands/other/CmdNick.cs index f1e7d5343..3d62bc82f 100644 --- a/Commands/other/CmdNick.cs +++ b/Commands/other/CmdNick.cs @@ -43,10 +43,10 @@ namespace MCGalaxy.Commands { string newName = parts.Length > 1 ? parts[1] : ""; if (newName == "") { who.DisplayName = who.name; - Player.SendChatFrom(who, who.color + who.prefix + who.DisplayName + "%S has reverted their nick to their original name.", false); + Player.SendChatFrom(who, who.FullName + "%S has reverted their nick to their original name.", false); } else { if (newName.Length > 60) { Player.SendMessage(p, "Nick must be under 60 letters."); return; } - Player.SendChatFrom(who, who.color + who.DisplayName + "%S has changed their nick to " + who.color + newName + "%S.", false); + Player.SendChatFrom(who, who.FullName + "%S has changed their nick to " + who.color + newName + "%S.", false); who.DisplayName = newName; } diff --git a/Commands/other/CmdReport.cs b/Commands/other/CmdReport.cs index 7f8cd7e8c..e99fadbe9 100644 --- a/Commands/other/CmdReport.cs +++ b/Commands/other/CmdReport.cs @@ -99,7 +99,7 @@ namespace MCGalaxy.Commands File.Delete("extra/reportedbackups/" + msg + ".txt"); File.Move("extra/reported/" + msg + ".txt", "extra/reportedbackups/" + msg + ".txt"); Player.SendMessage(p, "%a" + msg + "'s report has been deleted."); - Chat.GlobalMessageOps(p.prefix + p.color + p.name + Server.DefaultColor + " deleted " + msg + "'s report."); + Chat.GlobalMessageOps(p.FullName + " %Sdeleted " + msg + "'s report."); Server.s.Log(msg + "'s report has been deleted by " + p.name); } else diff --git a/Commands/other/CmdTitle.cs b/Commands/other/CmdTitle.cs index 37004aebc..96e6e5df4 100644 --- a/Commands/other/CmdTitle.cs +++ b/Commands/other/CmdTitle.cs @@ -45,11 +45,11 @@ namespace MCGalaxy.Commands { if (newTitle.Length > 17) { Player.SendMessage(p, "Title must be under 17 letters."); return; } if (newTitle == "") { - Player.SendChatFrom(who, who.color + who.prefix + who.name + " %Shad their title removed.", false); + Player.SendChatFrom(who, who.FullName + " %Shad their title removed.", false); query.AddParam("@Name", who.name); Database.executeQuery(query, "UPDATE Players SET Title = '' WHERE Name = @Name"); } else { - Player.SendChatFrom(who, who.color + who.name + " %Swas given the title of &b[" + newTitle + "%b]", false); + Player.SendChatFrom(who, who.FullName + " %Swas given the title of &b[" + newTitle + "%b]", false); query.AddParam("@Title", newTitle); query.AddParam("@Name", who.name); Database.executeQuery(query, "UPDATE Players SET Title = @Title WHERE Name = @Name"); diff --git a/Games/CTF/CtfTeam.cs b/Games/CTF/CtfTeam.cs index 86db58ffd..5ae9ac126 100644 --- a/Games/CTF/CtfTeam.cs +++ b/Games/CTF/CtfTeam.cs @@ -51,7 +51,7 @@ namespace MCGalaxy p.hasflag = null; p.prefix = p.color + "[" + Colors.Name("&" + color).ToUpper() + "] "; players.Add(p); - mapOn.ChatLevel(p.color + p.prefix + p.name + Server.DefaultColor + " has joined the " + teamstring + "."); + mapOn.ChatLevel(p.FullName + " %Shas joined the " + teamstring + "."); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); } } @@ -67,7 +67,7 @@ namespace MCGalaxy //p.carryingFlag = false; p.hasflag = null; players.Remove(p); - mapOn.ChatLevel(p.color + p.prefix + p.name + Server.DefaultColor + " has left the " + teamstring + "."); + mapOn.ChatLevel(p.FullName + " %Shas left the " + teamstring + "."); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); } } diff --git a/Games/ZombieSurvival/ZombieGame.Game.cs b/Games/ZombieSurvival/ZombieGame.Game.cs index a4417396d..2c2c70a37 100644 --- a/Games/ZombieSurvival/ZombieGame.Game.cs +++ b/Games/ZombieSurvival/ZombieGame.Game.cs @@ -56,7 +56,7 @@ namespace MCGalaxy { return false; } - public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z, + public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z, byte rotX, byte rotY) { if (!p.referee && noRespawn) { if (p.pos[0] >= x + 70 || p.pos[0] <= x - 70 ) { @@ -90,16 +90,19 @@ namespace MCGalaxy { } public override void PlayerJoinedServer(Player p) { - if (Status != ZombieGameStatus.NotStarted) - Player.SendMessage(p, "There is a Zombie Survival game currently in-progress! " + - "Join it by typing /g " + Server.zombie.currentLevelName); + if (Status == ZombieGameStatus.NotStarted) return; + Player.SendMessage(p, "There is a Zombie Survival game currently in-progress! " + + "Join it by typing /g " + Server.zombie.currentLevelName); } public override void PlayerJoinedLevel(Player p, Level oldLevl) { if (Server.zombie.RoundInProgress && p.level.name == currentLevelName) Server.zombie.InfectedPlayerLogin(p); - - if (p.level.name == currentLevelName) return; + if (p.level.name == currentLevelName) { + //p.SendMessage(CpeMessageType.BottomRight1, "%SYou have &a" + p.money + " %S" + Server.moneys); + return; + } + p.SendMessage(CpeMessageType.BottomRight1, ""); if(ZombieGame.alive.Contains(p)) ZombieGame.alive.Remove(p); if (ZombieGame.infectd.Contains(p)) diff --git a/Network/Player.Networking.cs b/Network/Player.Networking.cs index afa7cb7b8..b57ab9a3d 100644 --- a/Network/Player.Networking.cs +++ b/Network/Player.Networking.cs @@ -174,19 +174,25 @@ namespace MCGalaxy { else Server.IRC.Pm(Server.IRC.usedCmd, message); } else { - p.SendMessage(0, Server.DefaultColor + message, colorParse); + p.SendMessage(CpeMessageType.Normal, Server.DefaultColor + message, colorParse); } } public void SendMessage(string message) { - SendMessage(0, Server.DefaultColor + message, true); + SendMessage(CpeMessageType.Normal, Server.DefaultColor + message, true); } public void SendMessage(string message, bool colorParse) { - SendMessage(0, Server.DefaultColor + message, colorParse); + SendMessage(CpeMessageType.Normal, Server.DefaultColor + message, colorParse); } + [Obsolete("Use the overload with the CpeMessageType parameter.")] public void SendMessage(byte id, string message, bool colorParse = true) { + SendMessage((CpeMessageType)id, message, colorParse); + } + + public void SendMessage(CpeMessageType id, string message, bool colorParse = true) { + if (id != CpeMessageType.Normal && !HasCpeExt(CpeExt.MessageTypes)) return; if (colorParse) message = Colors.EscapeColors(message); StringBuilder sb = new StringBuilder(message); @@ -222,7 +228,7 @@ namespace MCGalaxy { byte[] buffer = new byte[66]; buffer[0] = Opcode.Message; - buffer[1] = id; + buffer[1] = (byte)id; if (HasCpeExt(CpeExt.FullCP437)) NetUtils.WriteCP437(newLine, buffer, 2); else diff --git a/Player/Player.CPE.cs b/Player/Player.CPE.cs index 8a227f7c5..b266fa012 100644 --- a/Player/Player.CPE.cs +++ b/Player/Player.CPE.cs @@ -270,4 +270,10 @@ namespace MCGalaxy public const string TextColors = "TextColors"; public const string BulkBlockUpdate = "BulkBlockUpdate"; } + + public enum CpeMessageType : byte { + Normal = 0, Status1 = 1, Status2 = 2, Status3 = 3, + BottomRight1 = 11, BottomRight2 = 12, BottomRight3 = 13, + Announcement = 100, + } } \ No newline at end of file