From 834612d3fbbc512c0c2f6cf0d658a69a6520eb2a Mon Sep 17 00:00:00 2001 From: RichardSquires Date: Sat, 5 Aug 2023 12:24:00 +0100 Subject: [PATCH] Updated example echo command example --- Examples/EchoCommand/Server/EchoCommand.cs | 32 ++++++++-------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/Examples/EchoCommand/Server/EchoCommand.cs b/Examples/EchoCommand/Server/EchoCommand.cs index 06d7d37..251cca6 100644 --- a/Examples/EchoCommand/Server/EchoCommand.cs +++ b/Examples/EchoCommand/Server/EchoCommand.cs @@ -1,22 +1,12 @@ -namespace Eco -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using System.Threading.Tasks; - using Eco.Gameplay.Objects; - using Eco.Gameplay.Players; - using Eco.Gameplay.Systems.Chat; - using Eco.Mods.TechTree; - using Eco.Shared.Localization; - using Eco.Shared.Math; - using Eco.Shared.Networking; - using Eco.Shared.Services; - using Eco.Shared.Utils; - using Eco.World.Blocks; +using Eco.Gameplay.Players; +using Eco.Gameplay.Systems.Messaging.Chat; +using Eco.Gameplay.Systems.Messaging.Chat.Commands; +using Eco.Shared.Localization; - public class EchoCommand : IChatCommandHandler +namespace EcoChat +{ + [ChatCommandHandler] + public class EchoCommand { /// /// Chat command for server administrators for repeating a message back to the sender @@ -28,10 +18,10 @@ public static void Echo(User user, string message = "") { if (message.Length == 0) { - ChatManager.ServerMessageToPlayer(Localizer.DoStr("Invalid usage. You must specify a message."), user); + ChatManager.SendMessage(user, user, Localizer.DoStr("Invalid usage. You must specify a message.")); return; } - ChatManager.ServerMessageToPlayer(Localizer.DoStr(message), user); + ChatManager.SendMessage(user, user, Localizer.DoStr(message)); } } -} +} \ No newline at end of file