From b5e327eded8ff7c14ec30e5cb26cd6c1c0498b48 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 11 Jun 2018 14:00:31 +1000 Subject: [PATCH] more work on chat rewrite --- MCGalaxy/Chat/Chat.cs | 19 ++++---- MCGalaxy/Commands/CPE/CustomBlockCommand.cs | 4 +- MCGalaxy/Commands/Chat/CmdChatRoom.cs | 3 +- MCGalaxy/Commands/Chat/CmdClear.cs | 4 +- MCGalaxy/Commands/Chat/CmdHug.cs | 2 +- MCGalaxy/Commands/Economy/CmdBalance.cs | 4 +- MCGalaxy/Commands/Economy/CmdBuy.cs | 2 +- MCGalaxy/Commands/Economy/CmdGive.cs | 6 +-- MCGalaxy/Commands/Economy/CmdPay.cs | 6 +-- MCGalaxy/Commands/Economy/CmdStore.cs | 2 +- MCGalaxy/Commands/Economy/CmdTake.cs | 2 +- .../Commands/Fun/ZombieSurvival/CmdHuman.cs | 4 +- MCGalaxy/Commands/Information/CmdMapInfo.cs | 6 +-- MCGalaxy/Commands/Maintenance/CmdBlockDB.cs | 2 +- MCGalaxy/Commands/Moderation/CmdPatrol.cs | 4 +- MCGalaxy/Commands/Moderation/CmdReport.cs | 2 +- MCGalaxy/CorePlugin/ChatHandler.cs | 43 ++++++++++++++----- MCGalaxy/CorePlugin/CorePlugin.cs | 3 ++ MCGalaxy/Economy/Item.cs | 6 +-- MCGalaxy/Economy/LevelItem.cs | 38 ++++++++-------- MCGalaxy/Economy/MessageItems.cs | 12 +++--- MCGalaxy/Economy/NameItems.cs | 16 +++---- MCGalaxy/Economy/RankItem.cs | 24 +++++------ MCGalaxy/Economy/ZombieItems.cs | 4 +- MCGalaxy/Events/ServerEvents.cs | 41 +++++++++++++++++- MCGalaxy/Games/MovementCheck.cs | 2 +- MCGalaxy/Games/Team.cs | 9 ++-- MCGalaxy/Games/ZombieSurvival/ZSGame.Round.cs | 2 +- MCGalaxy/Network/IRCPlugin/IRCBot.cs | 1 + MCGalaxy/Player/Player.Handlers.cs | 4 +- 30 files changed, 170 insertions(+), 107 deletions(-) diff --git a/MCGalaxy/Chat/Chat.cs b/MCGalaxy/Chat/Chat.cs index 87a9d2dbb..daabad8f2 100644 --- a/MCGalaxy/Chat/Chat.cs +++ b/MCGalaxy/Chat/Chat.cs @@ -15,6 +15,7 @@ permissions and limitations under the Licenses. using System; using System.Text; using MCGalaxy.Commands; +using MCGalaxy.Events.ServerEvents; namespace MCGalaxy { public enum ChatScope { @@ -28,6 +29,8 @@ namespace MCGalaxy { Level, /// Messages all players in (or spying on) a particular chatroom. Chatroom, + /// Messages all players in all chatrooms. + AllChatrooms, /// Messages all players of a given rank Rank, @@ -85,14 +88,15 @@ namespace MCGalaxy { string room = (string)arg; return pl.Chatroom == room || pl.spyChatRooms.CaselessContains(room); } + public static bool FilterAllChatrooms(Player pl, object arg) { return pl.Chatroom != null; } public static bool FilterRank(Player pl, object arg) { return pl.Rank == (LevelPermission)arg; } public static bool FilterAboveOrSameRank(Player pl, object arg) { return pl.Rank >= (LevelPermission)arg; } public static bool FilterBelowRank(Player pl, object arg) { return pl.Rank < (LevelPermission)arg; } - static ChatMessageFilter[] scopeFilters = new ChatMessageFilter[] { - FilterAll, FilterGlobal, FilterLevel, FilterChatroom, - FilterRank, FilterAboveOrSameRank, FilterBelowRank, + public static ChatMessageFilter[] scopeFilters = new ChatMessageFilter[] { + FilterAll, FilterGlobal, FilterLevel, FilterChatroom, + FilterAllChatrooms, FilterRank, FilterAboveOrSameRank, FilterBelowRank, }; public static ChatMessageFilter FilterVisible(Player source) { @@ -129,14 +133,13 @@ namespace MCGalaxy { Player[] players = PlayerInfo.Online.Items; ChatMessageFilter scopeFilter = scopeFilters[(int)scope]; + OnChatSysEvent.Call(scope, ref msg, arg, ref filter, irc); foreach (Player pl in players) { if (!scopeFilter(pl, arg)) continue; if (filter != null && !filter(pl, arg)) continue; Player.Message(pl, msg); } - - if (irc) Server.IRC.Say(msg); // TODO: check scope filter here } @@ -164,6 +167,7 @@ namespace MCGalaxy { ChatMessageFilter scopeFilter = scopeFilters[(int)scope]; if (source == null) source = ConsolePlayer.Instance; + OnChatFromEvent.Call(scope, source, ref msg, arg, ref filter, irc); foreach (Player pl in players) { if (!scopeFilter(pl, arg)) continue; if (filter != null && !filter(pl, arg)) continue; @@ -171,8 +175,6 @@ namespace MCGalaxy { if (!NotIgnoring(pl, source)) continue; Player.Message(pl, UnescapeMessage(pl, source, msg)); } - - if (irc) Server.IRC.Say(msg); // TODO: check scope filter here } @@ -192,6 +194,7 @@ namespace MCGalaxy { ChatMessageFilter scopeFilter = scopeFilters[(int)scope]; if (source == null) source = ConsolePlayer.Instance; + OnChatEvent.Call(scope, source, ref msg, arg, ref filter, irc); foreach (Player pl in players) { if (!NotIgnoring(pl, source)) continue; // Always show message to self too (unless ignoring self) @@ -202,8 +205,6 @@ namespace MCGalaxy { Player.Message(pl, UnescapeMessage(pl, source, msg)); } - - if (irc) Server.IRC.Say(msg); // TODO: check scope filter here source.CheckForMessageSpam(); } diff --git a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs index 54bef3a60..388f4dd14 100644 --- a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs +++ b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs @@ -103,7 +103,7 @@ namespace MCGalaxy.Commands.CPE { Player.Message(p, "Use %T{0} abort %Sat anytime to abort the creation process.", cmd); Player.Message(p, " Use %T{0} revert %Sto go back a step", cmd); Player.Message(p, " Use %T{0} [input] %Sto provide input", cmd); - Player.Message(p, "%f----------------------------------------------------------"); + Player.Message(p, "&f----------------------------------------------------------"); SetStep(p, global, 2); SendStepHelp(p, global); @@ -680,7 +680,7 @@ namespace MCGalaxy.Commands.CPE { for (int i = 0; i < help.Length; i++) Player.Message(p, help[i]); - Player.Message(p, "%f--------------------------"); + Player.Message(p, "&f--------------------------"); } static void SendEditHelp(Player p, string section) { diff --git a/MCGalaxy/Commands/Chat/CmdChatRoom.cs b/MCGalaxy/Commands/Chat/CmdChatRoom.cs index ae4a8736b..05d199552 100644 --- a/MCGalaxy/Commands/Chat/CmdChatRoom.cs +++ b/MCGalaxy/Commands/Chat/CmdChatRoom.cs @@ -242,8 +242,7 @@ namespace MCGalaxy.Commands.Chatting { Logger.Log(LogType.ChatroomChat, "{0}: {1}", p.name, message); message = " λNICK: &f" + message; - Chat.MessageFrom(ChatScope.All, p, message, - null, (pl, arg) => pl.Chatroom != null); + Chat.MessageChat(ChatScope.AllChatrooms, p, message, null, null); p.lastchatroomglobal = DateTime.UtcNow; } else { Player.Message(p, "Sorry, you must wait 30 seconds in between each global chatroom message!!"); diff --git a/MCGalaxy/Commands/Chat/CmdClear.cs b/MCGalaxy/Commands/Chat/CmdClear.cs index 422402c3a..dd4fa9a42 100644 --- a/MCGalaxy/Commands/Chat/CmdClear.cs +++ b/MCGalaxy/Commands/Chat/CmdClear.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands.Chatting { public override void Use(Player p, string message) { if (!message.CaselessEq("global")) { ClearChat(p); - Player.Message(p, "%4Chat cleared."); + Player.Message(p, "&4Chat cleared."); } else { if (!CheckExtraPerm(p, 1)) return; @@ -41,7 +41,7 @@ namespace MCGalaxy.Commands.Chatting { foreach (Player pl in players) { ClearChat(pl); } - Chat.MessageAll("%4Global Chat cleared."); + Chat.MessageAll("&4Global Chat cleared."); } } diff --git a/MCGalaxy/Commands/Chat/CmdHug.cs b/MCGalaxy/Commands/Chat/CmdHug.cs index 97c71a8c5..80fee8665 100644 --- a/MCGalaxy/Commands/Chat/CmdHug.cs +++ b/MCGalaxy/Commands/Chat/CmdHug.cs @@ -44,7 +44,7 @@ namespace MCGalaxy.Commands.Chatting { if (p != null && target.Rank > p.Rank) { MessageTooHighRank(p, "&cdeath-hug%S", true); return; } - target.HandleDeath(Block.Stone, "@p %Sdied from a %cdeadly hug."); + target.HandleDeath(Block.Stone, "@p %Sdied from a &cdeadly hug."); } } diff --git a/MCGalaxy/Commands/Economy/CmdBalance.cs b/MCGalaxy/Commands/Economy/CmdBalance.cs index ad0b15a15..124cb39f4 100644 --- a/MCGalaxy/Commands/Economy/CmdBalance.cs +++ b/MCGalaxy/Commands/Economy/CmdBalance.cs @@ -82,13 +82,13 @@ namespace MCGalaxy.Commands.Eco { if (!DateTime.TryParseExact(date, dateFormat, null, 0, out time)) return false; TimeSpan delta = DateTime.Now - time; - value = prefix + " %f" + delta.Shorten() + " ago" + suffix; + value = prefix + " &f" + delta.Shorten() + " ago" + suffix; return true; } public override void Help(Player p) { Player.Message(p, "%T/Balance [player]"); - Player.Message(p, "%HShows how much %3" + ServerConfig.Currency + " %H[player] has, " + + Player.Message(p, "%HShows how much &3" + ServerConfig.Currency + " %H[player] has, " + "plus their most recent transactions."); Player.Message(p, "%HIf [player] is not given, shows your own balance."); } diff --git a/MCGalaxy/Commands/Economy/CmdBuy.cs b/MCGalaxy/Commands/Economy/CmdBuy.cs index efd05a2fd..e258a1ab1 100644 --- a/MCGalaxy/Commands/Economy/CmdBuy.cs +++ b/MCGalaxy/Commands/Economy/CmdBuy.cs @@ -32,7 +32,7 @@ namespace MCGalaxy.Commands.Eco { if (item == null) { Help(p); return; } if (!item.Enabled) { - Player.Message(p, "%cThe {0} item is not currently buyable.", item.Name); return; + Player.Message(p, "&cThe {0} item is not currently buyable.", item.Name); return; } if (p.Rank < item.PurchaseRank) { Formatter.MessageNeedMinPerm(p, "+ can purchase a " + item.Name, item.PurchaseRank); return; diff --git a/MCGalaxy/Commands/Economy/CmdGive.cs b/MCGalaxy/Commands/Economy/CmdGive.cs index b8955c568..0872980de 100644 --- a/MCGalaxy/Commands/Economy/CmdGive.cs +++ b/MCGalaxy/Commands/Economy/CmdGive.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands.Eco { int matches = 1; Player who = PlayerInfo.FindMatches(p, data.TargetName, out matches); if (matches > 1) return; - if (p != null && p == who) { Player.Message(p, "You cannot give yourself %3" + ServerConfig.Currency); return; } + if (p != null && p == who) { Player.Message(p, "You cannot give yourself &3" + ServerConfig.Currency); return; } int money = 0; if (who == null) { @@ -58,14 +58,14 @@ namespace MCGalaxy.Commands.Eco { static bool ReachedMax(Player p, int current, int amount) { if (current + amount > 16777215) { - Player.Message(p, "%cPlayers cannot have over %316,777,215 %3" + ServerConfig.Currency); return true; + Player.Message(p, "&cPlayers cannot have over &316,777,215 &3" + ServerConfig.Currency); return true; } return false; } public override void Help(Player p) { Player.Message(p, "%T/Give [player] [amount] "); - Player.Message(p, "%HGives [player] [amount] %3" + ServerConfig.Currency); + Player.Message(p, "%HGives [player] [amount] &3" + ServerConfig.Currency); } } } diff --git a/MCGalaxy/Commands/Economy/CmdPay.cs b/MCGalaxy/Commands/Economy/CmdPay.cs index 93c630cb8..12eb5f00c 100644 --- a/MCGalaxy/Commands/Economy/CmdPay.cs +++ b/MCGalaxy/Commands/Economy/CmdPay.cs @@ -32,7 +32,7 @@ namespace MCGalaxy.Commands.Eco { int matches = 1; Player who = PlayerInfo.FindMatches(p, data.TargetName, out matches); if (matches > 1) return; - if (p != null && p == who) { Player.Message(p, "You cannot pay yourself %3" + ServerConfig.Currency); return; } + if (p != null && p == who) { Player.Message(p, "You cannot pay yourself &3" + ServerConfig.Currency); return; } int money, srcMoney = Player.IsSuper(p) ? int.MaxValue : p.money; if (who == null) { @@ -57,10 +57,10 @@ namespace MCGalaxy.Commands.Eco { static bool IsLegalPayment(Player p, int payer, int receiver, int amount) { if (receiver + amount > 16777215) { - Player.Message(p, "%cPlayers cannot have over %f16777215 %3" + ServerConfig.Currency); return false; + Player.Message(p, "&cPlayers cannot have over &f16777215 &3" + ServerConfig.Currency); return false; } if (payer < amount) { - Player.Message(p, "%cYou don't have enough %3" + ServerConfig.Currency); return false; + Player.Message(p, "&cYou don't have enough &3" + ServerConfig.Currency); return false; } return true; } diff --git a/MCGalaxy/Commands/Economy/CmdStore.cs b/MCGalaxy/Commands/Economy/CmdStore.cs index 931d1b651..2bcef8345 100644 --- a/MCGalaxy/Commands/Economy/CmdStore.cs +++ b/MCGalaxy/Commands/Economy/CmdStore.cs @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands.Eco { if (item == null) { Help(p); return; } if (!item.Enabled) { - Player.Message(p, "%cThe " + item.ShopName + " item is not currently buyable."); return; + Player.Message(p, "&cThe " + item.ShopName + " item is not currently buyable."); return; } item.OnStoreCommand(p); } diff --git a/MCGalaxy/Commands/Economy/CmdTake.cs b/MCGalaxy/Commands/Economy/CmdTake.cs index 1d09051d6..3d87fe38b 100644 --- a/MCGalaxy/Commands/Economy/CmdTake.cs +++ b/MCGalaxy/Commands/Economy/CmdTake.cs @@ -32,7 +32,7 @@ namespace MCGalaxy.Commands.Eco { int matches = 1; Player who = PlayerInfo.FindMatches(p, data.TargetName, out matches); if (matches > 1) return; - if (p != null && p == who) { Player.Message(p, "%cYou can't take %3" + ServerConfig.Currency + "%c from yourself"); return; } + if (p != null && p == who) { Player.Message(p, "&cYou can't take &3" + ServerConfig.Currency + "&c from yourself"); return; } int money = 0; if (who == null) { diff --git a/MCGalaxy/Commands/Fun/ZombieSurvival/CmdHuman.cs b/MCGalaxy/Commands/Fun/ZombieSurvival/CmdHuman.cs index dd72352f9..36e1f7728 100644 --- a/MCGalaxy/Commands/Fun/ZombieSurvival/CmdHuman.cs +++ b/MCGalaxy/Commands/Fun/ZombieSurvival/CmdHuman.cs @@ -54,8 +54,8 @@ namespace MCGalaxy.Commands.Fun { public override void Help(Player p) { Player.Message(p, "%T/Human %H- pledges that you will not be infected."); - Player.Message(p, "%HIf you survive, you receive an &aextra 5 %3" + ServerConfig.Currency); - Player.Message(p, "%HHowever, if you are infected, you will &close 2 %3" + ServerConfig.Currency); + Player.Message(p, "%HIf you survive, you receive an &aextra 5 &3" + ServerConfig.Currency); + Player.Message(p, "%HHowever, if you are infected, you will &close 2 &3" + ServerConfig.Currency); } } } diff --git a/MCGalaxy/Commands/Information/CmdMapInfo.cs b/MCGalaxy/Commands/Information/CmdMapInfo.cs index 26bd64da7..d7bab6b2c 100644 --- a/MCGalaxy/Commands/Information/CmdMapInfo.cs +++ b/MCGalaxy/Commands/Information/CmdMapInfo.cs @@ -156,14 +156,14 @@ namespace MCGalaxy.Commands.Info { void ShowEnv(Player p, MapInfoData data, LevelConfig cfg) { string url = cfg.Terrain.Length > 0 ? cfg.Terrain : ServerConfig.DefaultTerrain; if (url.Length > 0) { - Player.Message(p, "Terrain: %b" + url); + Player.Message(p, "Terrain: &b" + url); } else { Player.Message(p, "No custom terrain set for this map."); } url = cfg.TexturePack.Length > 0 ? cfg.TexturePack : ServerConfig.DefaultTexture; if (url.Length > 0) { - Player.Message(p, "Texture pack: %b" + url); + Player.Message(p, "Texture pack: &b" + url); } else { Player.Message(p, "No custom texture pack set for this map."); } @@ -226,7 +226,7 @@ namespace MCGalaxy.Commands.Info { } static string Color(string src) { - return (src == null || src.Length == 0 || src == "-1") ? "%bnone%e" : "%b" + src + "%e"; + return (src == null || src.Length == 0 || src == "-1") ? "&bnone&e" : "&b" + src + "&e"; } public override void Help(Player p) { diff --git a/MCGalaxy/Commands/Maintenance/CmdBlockDB.cs b/MCGalaxy/Commands/Maintenance/CmdBlockDB.cs index 0983d5f27..2a11516e7 100644 --- a/MCGalaxy/Commands/Maintenance/CmdBlockDB.cs +++ b/MCGalaxy/Commands/Maintenance/CmdBlockDB.cs @@ -71,7 +71,7 @@ namespace MCGalaxy.Commands.Maintenance { Player.Message(p, "%T/BlockDB enable [map]"); Player.Message(p, "%HEnables %Hrecording block changes to the BlockDB for [map]"); Player.Message(p, "%HIf no map name is given, uses your current map."); - Player.Message(p, "%CUse these commands with great caution!"); + Player.Message(p, "&cUse these commands with great caution!"); } } } \ No newline at end of file diff --git a/MCGalaxy/Commands/Moderation/CmdPatrol.cs b/MCGalaxy/Commands/Moderation/CmdPatrol.cs index 7ad539720..d0e634432 100644 --- a/MCGalaxy/Commands/Moderation/CmdPatrol.cs +++ b/MCGalaxy/Commands/Moderation/CmdPatrol.cs @@ -48,10 +48,10 @@ namespace MCGalaxy.Commands.Moderation { List GetPatrolCandidates(Player p) { List candidates = new List(); LevelPermission perm = CommandExtraPerms.MinPerm(name); - Player[] online = PlayerInfo.Online.Items; + Player[] players = PlayerInfo.Online.Items; DateTime cutoff = DateTime.UtcNow.AddSeconds(-15); - foreach (Player target in online) { + foreach (Player target in players) { if (target.Rank > perm || target == p || !Entities.CanSee(p, target)) continue; if (target.LastPatrol > cutoff) continue; candidates.Add(target); diff --git a/MCGalaxy/Commands/Moderation/CmdReport.cs b/MCGalaxy/Commands/Moderation/CmdReport.cs index b725f179b..accb77de2 100644 --- a/MCGalaxy/Commands/Moderation/CmdReport.cs +++ b/MCGalaxy/Commands/Moderation/CmdReport.cs @@ -153,7 +153,7 @@ namespace MCGalaxy.Commands.Moderation { LevelPermission checkRank = CommandExtraPerms.Find(name, 1).MinRank; string checkRankName = Group.GetColoredName(checkRank); if (reports.Count >= 5) { - Player.Message(p, "{0} &calready has 5 reports! Please wait until an {1}%c+ has reviewed these reports first!", + Player.Message(p, "{0} &calready has 5 reports! Please wait until an {1}&c+ has reviewed these reports first!", PlayerInfo.GetColoredName(p, target), checkRankName); return; } diff --git a/MCGalaxy/CorePlugin/ChatHandler.cs b/MCGalaxy/CorePlugin/ChatHandler.cs index 2d8227741..526677040 100644 --- a/MCGalaxy/CorePlugin/ChatHandler.cs +++ b/MCGalaxy/CorePlugin/ChatHandler.cs @@ -16,45 +16,68 @@ permissions and limitations under the Licenses. */ using System; -using MCGalaxy.Events; using MCGalaxy.Commands.Chatting; namespace MCGalaxy.Core { internal static class ChatHandler { + internal static void HandleOnChat(ChatScope scope, Player source, ref string msg, + object arg, ref ChatMessageFilter filter, bool irc) { + msg = msg.Replace("λFULL", source.name).Replace("λNICK", source.name); + LogType logType = LogType.PlayerChat; + + if (scope == ChatScope.AboveEqRank) { + logType = LogType.StaffChat; + } else if (scope == ChatScope.Chatroom || scope == ChatScope.AllChatrooms) { + logType = LogType.ChatroomChat; + } else if (scope == ChatScope.Rank) { + logType = LogType.RankChat; + } + + Logger.Log(logType, msg); + Player[] players = PlayerInfo.Online.Items; + ChatMessageFilter scopeFilter = Chat.scopeFilters[(int)scope]; + + foreach (Player pl in players) { + if (pl == source || !Chat.NotIgnoring(pl, source)) continue; + if (!scopeFilter(pl, arg)) continue; + if (filter != null && !filter(pl, arg)) continue; + + source.TotalMessagesSent++; break; + } + } + internal static void HandleCommand(Player p, string cmd, string args) { if (!ServerConfig.CoreSecretCommands) return; - //DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla + // DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla if (cmd == "pony") { p.cancelcommand = true; if (!MessageCmd.CanSpeak(p, cmd)) return; - int ponycount = p.Extras.GetInt("MCG_PONY", 0); + int used = p.Extras.GetInt("MCG_PONY"); - if (ponycount < 2) { + if (used < 2) { Chat.MessageFrom(p, "λNICK %Sjust so happens to be a proud brony! Everyone give λNICK %Sa brohoof!"); Logger.Log(LogType.CommandUsage, "{0} used /{1}", p.name, cmd); } else { Player.Message(p, "You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); } - ponycount++; - p.Extras.PutInt("MCGalaxy_Core_Pony", ponycount); + p.Extras.PutInt("MCG_PONY", used + 1); } else if (cmd == "rainbowdashlikescoolthings") { p.cancelcommand = true; if (!MessageCmd.CanSpeak(p, cmd)) return; - int rdcount = p.Extras.GetInt("MCG_RD", 0); + int used = p.Extras.GetInt("MCG_RD"); - if (rdcount < 2) { + if (used < 2) { Chat.MessageGlobal("&4T&6H&eI&aS&3 S&9E&1R&4V&6E&eR &aJ&3U&9S&1T &4G&6O&eT &a2&30 &9P&1E&4R&6C&eE&aN&3T &9C&1O&4O&6L&eE&aR&3!"); Logger.Log(LogType.CommandUsage, "{0} used /{1}", p.name, cmd); } else { Player.Message(p, "You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); } - rdcount++; - p.Extras.PutInt("MCGalaxy_Core_RD", rdcount); + p.Extras.PutInt("MCG_RD", used + 1); } } } diff --git a/MCGalaxy/CorePlugin/CorePlugin.cs b/MCGalaxy/CorePlugin/CorePlugin.cs index c592a9927..136522efb 100644 --- a/MCGalaxy/CorePlugin/CorePlugin.cs +++ b/MCGalaxy/CorePlugin/CorePlugin.cs @@ -20,6 +20,7 @@ using MCGalaxy.Events; using MCGalaxy.Events.EconomyEvents; using MCGalaxy.Events.GroupEvents; using MCGalaxy.Events.PlayerEvents; +using MCGalaxy.Events.ServerEvents; using MCGalaxy.Tasks; namespace MCGalaxy.Core { @@ -33,6 +34,7 @@ namespace MCGalaxy.Core { public override void Load(bool startup) { OnPlayerConnectEvent.Register(ConnectHandler.HandleConnect, Priority.Critical); OnPlayerCommandEvent.Register(ChatHandler.HandleCommand, Priority.Critical); + OnChatEvent.Register(ChatHandler.HandleOnChat, Priority.Critical); OnPlayerStartConnectingEvent.Register(ConnectingHandler.HandleConnecting, Priority.Critical); OnSentMapEvent.Register(MiscHandlers.HandleOnMapSent, Priority.Critical); @@ -50,6 +52,7 @@ namespace MCGalaxy.Core { public override void Unload(bool shutdown) { OnPlayerConnectEvent.Unregister(ConnectHandler.HandleConnect); OnPlayerCommandEvent.Unregister(ChatHandler.HandleCommand); + OnChatEvent.Unregister(ChatHandler.HandleOnChat); OnPlayerStartConnectingEvent.Unregister(ConnectingHandler.HandleConnecting); OnSentMapEvent.Unregister(MiscHandlers.HandleOnMapSent); diff --git a/MCGalaxy/Economy/Item.cs b/MCGalaxy/Economy/Item.cs index 4eabcba01..aea2765ea 100644 --- a/MCGalaxy/Economy/Item.cs +++ b/MCGalaxy/Economy/Item.cs @@ -51,10 +51,10 @@ namespace MCGalaxy.Eco { internal void Setup(Player p, string[] args) { switch (args[1].ToLower()) { case "enable": - Player.Message(p, "%aThe {0} item is now enabled.", Name); + Player.Message(p, "&aThe {0} item is now enabled.", Name); Enabled = true; break; case "disable": - Player.Message(p, "%aThe {0} item is now disabled.", Name); + Player.Message(p, "&aThe {0} item is now disabled.", Name); Enabled = false; break; case "purchaserank": if (args.Length == 2) { Player.Message(p, "You need to provide a rank name."); return; } @@ -115,7 +115,7 @@ namespace MCGalaxy.Eco { // Must always provide an argument. if (args.Length < 2) { OnStoreCommand(p); return; } if (p.money < Price) { - Player.Message(p, "%cYou don't have enough &3{1}&c to buy a {0}.", Name, ServerConfig.Currency); return; + Player.Message(p, "&cYou don't have enough &3{1} &cto buy a {0}.", Name, ServerConfig.Currency); return; } DoPurchase(p, message, args); } diff --git a/MCGalaxy/Economy/LevelItem.cs b/MCGalaxy/Economy/LevelItem.cs index e0b061025..62c2b70ba 100644 --- a/MCGalaxy/Economy/LevelItem.cs +++ b/MCGalaxy/Economy/LevelItem.cs @@ -76,16 +76,16 @@ namespace MCGalaxy.Eco { protected internal override void OnBuyCommand(Player p, string message, string[] args) { if (args.Length < 3) { OnStoreCommand(p); return; } LevelPreset preset = FindPreset(args[1]); - if (preset == null) { Player.Message(p, "%cThat isn't a level preset"); return; } + if (preset == null) { Player.Message(p, "&cThat isn't a level preset"); return; } if (p.money < preset.price) { - Player.Message(p, "%cYou don't have enough %3" + ServerConfig.Currency + "%c to buy that map"); return; + Player.Message(p, "&cYou don't have enough &3" + ServerConfig.Currency + "&c to buy that map"); return; } string name = p.name + "_" + args[2]; try { Command.Find("NewLvl").Use(null, name + " " + preset.x + " " + preset.y + " " + preset.z + " " + preset.type); - Player.Message(p, "%aCreating level: '%f" + name + "%a' . . ."); + Player.Message(p, "&aCreating level: '&f" + name + "&a' . . ."); CmdLoad.LoadLevel(null, name); Level level = LevelInfo.FindExact(name); @@ -93,9 +93,9 @@ namespace MCGalaxy.Eco { Level.SaveSettings(level); PlayerActions.ChangeMap(p, name); - Player.Message(p, "%aSuccessfully created your map: '%f" + name + "%a'"); + Player.Message(p, "&aSuccessfully created your map: '&f" + name + "&a'"); } catch { - Player.Message(p, "%cSomething went wrong, Money untouched"); return; + Player.Message(p, "&cSomething went wrong, Money untouched"); return; } Economy.MakePurchase(p, preset.price, "%3Map: %f" + preset.name); } @@ -116,14 +116,14 @@ namespace MCGalaxy.Eco { } void AddPreset(Player p, string[] args, LevelPreset preset) { - if (preset != null) { Player.Message(p, "%cThat preset level already exists"); return; } + if (preset != null) { Player.Message(p, "&cThat preset level already exists"); return; } preset = new LevelPreset(); preset.name = args[2]; if (OkayAxis(args[3]) && OkayAxis(args[4]) && OkayAxis(args[5])) { preset.x = args[3]; preset.y = args[4]; preset.z = args[5]; } else { - Player.Message(p, "%cDimension must be a power of 2"); return; + Player.Message(p, "&cDimension must be a power of 2"); return; } if (!MapGen.IsRecognisedTheme(args[6])) { @@ -133,43 +133,43 @@ namespace MCGalaxy.Eco { if (!CommandParser.GetInt(p, args[7], "Price", ref preset.price, 0)) return; Presets.Add(preset); - Player.Message(p, "%aSuccessfully added the following map preset:"); - Player.Message(p, "Name: %f" + preset.name); + Player.Message(p, "&aSuccessfully added the following map preset:"); + Player.Message(p, "Name: &f" + preset.name); Player.Message(p, "x:" + preset.x + ", y:" + preset.y + ", z:" + preset.z); - Player.Message(p, "Map Type: %f" + preset.type); - Player.Message(p, "Map Price: %f" + preset.price + " %3" + ServerConfig.Currency); + Player.Message(p, "Map Type: &f" + preset.type); + Player.Message(p, "Map Price: &f" + preset.price + " &3" + ServerConfig.Currency); } void RemovePreset(Player p, string[] args, LevelPreset preset) { - if (preset == null) { Player.Message(p, "%cThat preset level doesn't exist"); return; } + if (preset == null) { Player.Message(p, "&cThat preset level doesn't exist"); return; } Presets.Remove(preset); - Player.Message(p, "%aSuccessfully removed preset: %f" + preset.name); + Player.Message(p, "&aSuccessfully removed preset: &f" + preset.name); } void EditPreset(Player p, string[] args, LevelPreset preset) { - if (preset == null) { Player.Message(p, "%cThat preset level doesn't exist"); return; } + if (preset == null) { Player.Message(p, "&cThat preset level doesn't exist"); return; } if (args[3] == "name" || args[3] == "title") { preset.name = args[4]; - Player.Message(p, "%aSuccessfully changed preset name to %f" + preset.name); + Player.Message(p, "&aSuccessfully changed preset name to &f" + preset.name); } else if (args[3] == "x" || args[3] == "y" || args[3] == "z") { - if (!OkayAxis(args[4])) { Player.Message(p, "%cDimension was wrong, it must be a power of 2"); return; } + if (!OkayAxis(args[4])) { Player.Message(p, "&cDimension was wrong, it must be a power of 2"); return; } if (args[3] == "x") preset.x = args[4]; if (args[3] == "y") preset.y = args[4]; if (args[3] == "z") preset.z = args[4]; - Player.Message(p, "%aSuccessfully changed preset {0} size to %f{1}", args[3], args[4]); + Player.Message(p, "&aSuccessfully changed preset {0} size to &f{1}", args[3], args[4]); } else if (args[3] == "type" || args[3] == "theme") { if (!MapGen.IsRecognisedTheme(args[4])) { MapGen.PrintThemes(p); return; } preset.type = args[4].ToLower(); - Player.Message(p, "%aSuccessfully changed preset type to %f" + preset.type); + Player.Message(p, "&aSuccessfully changed preset type to &f" + preset.type); } else if (args[3] == "price") { int newPrice = 0; if (!CommandParser.GetInt(p, args[4], "Price", ref newPrice, 0)) return; preset.price = newPrice; - Player.Message(p, "%aSuccessfully changed preset price to %f" + preset.price + " %3" + ServerConfig.Currency); + Player.Message(p, "&aSuccessfully changed preset price to &f" + preset.price + " &3" + ServerConfig.Currency); } else { Player.Message(p, "Supported properties to edit: name, title, x, y, z, type, price"); } diff --git a/MCGalaxy/Economy/MessageItems.cs b/MCGalaxy/Economy/MessageItems.cs index bcebad307..683383dd6 100644 --- a/MCGalaxy/Economy/MessageItems.cs +++ b/MCGalaxy/Economy/MessageItems.cs @@ -32,16 +32,16 @@ namespace MCGalaxy.Eco { protected override void DoPurchase(Player p, string message, string[] args) { if (args.Length == 1) { Command.Find("LoginMessage").Use(p, "-own"); - Player.Message(p, "%aYour login message was removed for free."); + Player.Message(p, "&aYour login message was removed for free."); return; } string text = message.SplitSpaces(2)[1]; // keep spaces this way if (text == PlayerDB.GetLoginMessage(p)) { - Player.Message(p, "%cYou already have that login message."); return; + Player.Message(p, "&cYou already have that login message."); return; } if (text.Length > NetUtils.StringSize) { - Player.Message(p, "%cLogin message must be 64 characters or less."); return; + Player.Message(p, "&cLogin message must be 64 characters or less."); return; } Command.Find("LoginMessage").Use(p, "-own " + text); Economy.MakePurchase(p, Price, "%3LoginMessage: %f" + text); @@ -60,16 +60,16 @@ namespace MCGalaxy.Eco { protected override void DoPurchase(Player p, string message, string[] args) { if (args.Length == 1) { Command.Find("LogoutMessage").Use(p, "-own"); - Player.Message(p, "%aYour logout message was removed for free."); + Player.Message(p, "&aYour logout message was removed for free."); return; } string text = message.SplitSpaces(2)[1]; // keep spaces this way if (text == PlayerDB.GetLogoutMessage(p)) { - Player.Message(p, "%cYou already have that logout message."); return; + Player.Message(p, "&cYou already have that logout message."); return; } if (text.Length > NetUtils.StringSize) { - Player.Message(p, "%cLogin message must be 64 characters or less."); return; + Player.Message(p, "&cLogin message must be 64 characters or less."); return; } Command.Find("LogoutMessage").Use(p, "-own " + text); Economy.MakePurchase(p, Price, "%3LogoutMessage: %f" + text); diff --git a/MCGalaxy/Economy/NameItems.cs b/MCGalaxy/Economy/NameItems.cs index 8a628dd49..569f7b844 100644 --- a/MCGalaxy/Economy/NameItems.cs +++ b/MCGalaxy/Economy/NameItems.cs @@ -31,15 +31,15 @@ namespace MCGalaxy.Eco { protected override void DoPurchase(Player p, string message, string[] args) { if (args.Length == 1) { Command.Find("Title").Use(p, "-own"); - Player.Message(p, "%aYour title was removed for free."); return; + Player.Message(p, "&aYour title was removed for free."); return; } string title = message.SplitSpaces(2)[1]; // keep spaces this way if (title == p.title) { - Player.Message(p, "%cYou already have that title."); return; + Player.Message(p, "&cYou already have that title."); return; } if (title.Length >= 20) { - Player.Message(p, "%cTitles must be under 20 characters."); return; + Player.Message(p, "&cTitles must be under 20 characters."); return; } Command.Find("Title").Use(p, "-own " + title); @@ -59,15 +59,15 @@ namespace MCGalaxy.Eco { protected override void DoPurchase(Player p, string message, string[] args) { if (args.Length == 1) { Command.Find("Nick").Use(p, "-own"); - Player.Message(p, "%aYour nickname was removed for free."); return; + Player.Message(p, "&aYour nickname was removed for free."); return; } string nick = message.SplitSpaces(2)[1]; // keep spaces this way if (nick == p.DisplayName) { - Player.Message(p, "%cYou already have that nickname."); return; + Player.Message(p, "&cYou already have that nickname."); return; } if (nick.Length >= 30) { - Player.Message(p, "%cNicknames must be under 30 characters."); return; + Player.Message(p, "&cNicknames must be under 30 characters."); return; } Command.Find("Nick").Use(p, "-own " + nick); @@ -89,7 +89,7 @@ namespace MCGalaxy.Eco { string colName = Colors.Name(color); if (color == p.titlecolor) { - Player.Message(p, "%cYou already have a " + color + colName + "%c titlecolor"); return; + Player.Message(p, "&cYou already have a " + color + colName + "&c titlecolor"); return; } Command.Find("TColor").Use(p, "-own " + colName); @@ -111,7 +111,7 @@ namespace MCGalaxy.Eco { string colName = Colors.Name(color); if (color == p.color) { - Player.Message(p, "%cYou already have a " + color + colName + "%c color"); return; + Player.Message(p, "&cYou already have a " + color + colName + "&c color"); return; } Command.Find("Color").Use(p, "-own " + colName); diff --git a/MCGalaxy/Economy/RankItem.cs b/MCGalaxy/Economy/RankItem.cs index 95baf3f72..af5834fb1 100644 --- a/MCGalaxy/Economy/RankItem.cs +++ b/MCGalaxy/Economy/RankItem.cs @@ -81,42 +81,42 @@ namespace MCGalaxy.Eco { protected internal override void OnBuyCommand(Player p, string message, string[] args) { if (args.Length >= 2) { - Player.Message(p, "%cYou cannot provide a rank name, use %a/buy rank %cto buy the NEXT rank."); return; + Player.Message(p, "&cYou cannot provide a rank name, use &a/buy rank &cto buy the NEXT rank."); return; } RankEntry nextRank = NextRank(p); if (nextRank == null) { - Player.Message(p, "%cYou are already at or past the max buyable rank"); return; + Player.Message(p, "&cYou are already at or past the max buyable rank"); return; } if (p.money < nextRank.Price) { - Player.Message(p, "%cYou don't have enough %3" + ServerConfig.Currency + "%c to buy the next rank"); return; + Player.Message(p, "&cYou don't have enough &3" + ServerConfig.Currency + "&c to buy the next rank"); return; } string rankName = Group.Find(nextRank.Perm).Name; // TODO: What if null reference happens here Command.Find("SetRank").Use(null, p.name + " " + rankName); Player.Message(p, "You bought the rank " + p.group.ColoredName); - Economy.MakePurchase(p, nextRank.Price, "%3Rank: " + p.group.ColoredName); + Economy.MakePurchase(p, nextRank.Price, "&3Rank: " + p.group.ColoredName); } protected internal override void OnSetupCommand(Player p, string[] args) { if (args[1].CaselessEq("price")) { Group grp = Matcher.FindRanks(p, args[2]); if (grp == null) return; - if (p != null && p.Rank < grp.Permission) { Player.Message(p, "%cCannot set price of a rank higher than yours."); return; } + if (p != null && p.Rank < grp.Permission) { Player.Message(p, "&cCannot set price of a rank higher than yours."); return; } int cost = 0; if (!CommandParser.GetInt(p, args[3], "Price", ref cost, 0)) return; - Player.Message(p, "%aSet price of rank {0} %ato &f{1} &3{2}", grp.ColoredName, cost, ServerConfig.Currency); + Player.Message(p, "&aSet price of rank {0} &ato &f{1} &3{2}", grp.ColoredName, cost, ServerConfig.Currency); GetOrAdd(grp.Permission).Price = cost; } else if (Command.IsDeleteCommand(args[1])) { Group grp = Matcher.FindRanks(p, args[2]); if (grp == null) return; - if (p != null && p.Rank < grp.Permission) { Player.Message(p, "%cCannot remove a rank higher than yours."); return; } + if (p != null && p.Rank < grp.Permission) { Player.Message(p, "&cCannot remove a rank higher than yours."); return; } if (Remove(grp.Permission)) { - Player.Message(p, "%aMade rank {0} %ano longer buyable", grp.ColoredName); + Player.Message(p, "&aMade rank {0} &ano longer buyable", grp.ColoredName); } else { - Player.Message(p, "%cThat rank was not buyable to begin with."); + Player.Message(p, "&cThat rank was not buyable to begin with."); } } else { OnSetupCommandHelp(p); @@ -144,12 +144,12 @@ namespace MCGalaxy.Eco { protected internal override void OnStoreCommand(Player p) { Player.Message(p, "%T/Buy rankup"); if (Ranks.Count == 0) { - Player.Message(p, "%cNo ranks have been setup be buyable. See %T/eco help rank"); return; + Player.Message(p, "&cNo ranks have been setup be buyable. See %T/eco help rank"); return; } LevelPermission maxRank = Ranks[Ranks.Count - 1].Perm; - Player.Message(p, "%fThe highest buyable rank is: {0}", Group.GetColoredName(maxRank)); - Player.Message(p, "%cYou can only buy ranks one at a time, in sequential order."); + Player.Message(p, "&fThe highest buyable rank is: {0}", Group.GetColoredName(maxRank)); + Player.Message(p, "&cYou can only buy ranks one at a time, in sequential order."); foreach (RankEntry rank in Ranks) { Player.Message(p, "&6{0} %S- &a{1} %S{2}", diff --git a/MCGalaxy/Economy/ZombieItems.cs b/MCGalaxy/Economy/ZombieItems.cs index 4b37f728d..c4e68ee16 100644 --- a/MCGalaxy/Economy/ZombieItems.cs +++ b/MCGalaxy/Economy/ZombieItems.cs @@ -110,7 +110,7 @@ namespace MCGalaxy.Eco { data.InfectMessages.Add(text); PlayerDB.AppendInfectMessage(p.name, text); - Player.Message(p, "%aAdded infect message: &f" + text); + Player.Message(p, "&aAdded infect message: &f" + text); Economy.MakePurchase(p, Price, "%3InfectMessage: " + message); } @@ -131,7 +131,7 @@ namespace MCGalaxy.Eco { protected internal override void OnBuyCommand(Player p, string message, string[] args) { if (p.money < Price) { - Player.Message(p, "%cYou don't have enough &3{1} &c to buy a {0}.", Name, ServerConfig.Currency); return; + Player.Message(p, "&cYou don't have enough &3{1} &cto buy a {0}.", Name, ServerConfig.Currency); return; } if (!Server.zombie.Running || !Server.zombie.RoundInProgress) { Player.Message(p, "You can only buy an invisiblity potion " + diff --git a/MCGalaxy/Events/ServerEvents.cs b/MCGalaxy/Events/ServerEvents.cs index ac342a7bd..e17d63c30 100644 --- a/MCGalaxy/Events/ServerEvents.cs +++ b/MCGalaxy/Events/ServerEvents.cs @@ -43,8 +43,45 @@ namespace MCGalaxy.Events.ServerEvents { } } - public delegate void OnChat(); + public delegate void OnChatSys(ChatScope scope, ref string msg, object arg, + ref ChatMessageFilter filter, bool irc); + public sealed class OnChatSysEvent : IEvent { + + public static void Call(ChatScope scope, ref string msg, object arg, + ref ChatMessageFilter filter, bool irc) { + IEvent[] items = handlers.Items; + for (int i = 0; i < items.Length; i++) { + try { items[i].method(scope, ref msg, arg, ref filter, irc); } + catch (Exception ex) { LogHandlerException(ex, items[i]); } + } + } + } + + public delegate void OnChatFrom(ChatScope scope, Player source, ref string msg, + object arg, ref ChatMessageFilter filter, bool irc); + public sealed class OnChatFromEvent : IEvent { + + public static void Call(ChatScope scope,Player source, ref string msg, + object arg, ref ChatMessageFilter filter, bool irc) { + IEvent[] items = handlers.Items; + for (int i = 0; i < items.Length; i++) { + try { items[i].method(scope, source, ref msg, arg, ref filter, irc); } + catch (Exception ex) { LogHandlerException(ex, items[i]); } + } + } + } + + public delegate void OnChat(ChatScope scope, Player source, ref string msg, + object arg, ref ChatMessageFilter filter, bool irc); public sealed class OnChatEvent : IEvent { - + + public static void Call(ChatScope scope, Player source, ref string msg, + object arg, ref ChatMessageFilter filter, bool irc) { + IEvent[] items = handlers.Items; + for (int i = 0; i < items.Length; i++) { + try { items[i].method(scope, source, ref msg, arg, ref filter, irc); } + catch (Exception ex) { LogHandlerException(ex, items[i]); } + } + } } } diff --git a/MCGalaxy/Games/MovementCheck.cs b/MCGalaxy/Games/MovementCheck.cs index 645bc5b38..10cfba888 100644 --- a/MCGalaxy/Games/MovementCheck.cs +++ b/MCGalaxy/Games/MovementCheck.cs @@ -52,7 +52,7 @@ namespace MCGalaxy.Games { DateTime now = DateTime.UtcNow; if (now < last) return; - Player.Message(p, "%4Do not {0} &c- ops have been warned.", action); + Player.Message(p, "&4Do not {0} &c- ops have been warned.", action); Chat.MessageFromOps(p, "λNICK &4appears to be " + action + "ing"); Logger.Log(LogType.SuspiciousActivity, "{0} appears to be {1}ing", p.name, action); last = now.AddSeconds(5); diff --git a/MCGalaxy/Games/Team.cs b/MCGalaxy/Games/Team.cs index 6c4e372e0..e0f5b48dc 100644 --- a/MCGalaxy/Games/Team.cs +++ b/MCGalaxy/Games/Team.cs @@ -34,14 +34,13 @@ namespace MCGalaxy.Games { } public void Message(Player source, string message) { - MessageOnline(source, "&9- to team - λNICK: &f" + message); + message = "&9- to team - λNICK: &f" + message; + Chat.MessageChat(ChatScope.All, source, message, this, + (pl, arg) => pl.Game.Team == arg); } public void Action(Player source, string message) { - MessageOnline(source, "Team - λNICK %S" + message); - } - - void MessageOnline(Player source, string message) { + message = "Team - λNICK %S" + message; Chat.MessageFrom(ChatScope.All, source, message, this, (pl, arg) => pl.Game.Team == arg); } diff --git a/MCGalaxy/Games/ZombieSurvival/ZSGame.Round.cs b/MCGalaxy/Games/ZombieSurvival/ZSGame.Round.cs index a3a71ac0d..47f5d97cc 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZSGame.Round.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZSGame.Round.cs @@ -286,7 +286,7 @@ namespace MCGalaxy.Games { void IncreaseAliveStats(Player p) { if (p.Game.PledgeSurvive) { - Player.Message(p, "You received &a5 %3" + ServerConfig.Currency + + Player.Message(p, "You received &a5 &3" + ServerConfig.Currency + " %Sfor successfully pledging that you would survive."); p.SetMoney(p.money + 5); } diff --git a/MCGalaxy/Network/IRCPlugin/IRCBot.cs b/MCGalaxy/Network/IRCPlugin/IRCBot.cs index c0c96df13..030da8d94 100644 --- a/MCGalaxy/Network/IRCPlugin/IRCBot.cs +++ b/MCGalaxy/Network/IRCPlugin/IRCBot.cs @@ -132,6 +132,7 @@ namespace MCGalaxy { message = EmotesHandler.Replace(message); message = ChatTokens.ApplyCustom(message); + message = message.Replace("&f", "%S"); message = Colors.ConvertMCToIRC(message.Replace("%S", ResetSignal)); return message; } diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs index 21f5ef947..d90d3c7ed 100644 --- a/MCGalaxy/Player/Player.Handlers.cs +++ b/MCGalaxy/Player/Player.Handlers.cs @@ -550,11 +550,11 @@ namespace MCGalaxy { if (IsPartialSpaced(text)) { partialMessage += text.Substring(0, text.Length - 2) + " "; - SendMessage(Colors.teal + "Partial message: &f" + partialMessage); + SendMessage("&3Partial message: &f" + partialMessage); return true; } else if (IsPartialJoined(text)) { partialMessage += text.Substring(0, text.Length - 2); - SendMessage(Colors.teal + "Partial message: &f" + partialMessage); + SendMessage("&3Partial message: &f" + partialMessage); return true; }