<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.play.eco/en/index.php?action=history&amp;feed=atom&amp;title=Custom_Chat_Commands</id>
	<title>Custom Chat Commands - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.play.eco/en/index.php?action=history&amp;feed=atom&amp;title=Custom_Chat_Commands"/>
	<link rel="alternate" type="text/html" href="https://wiki.play.eco/en/index.php?title=Custom_Chat_Commands&amp;action=history"/>
	<updated>2026-06-04T03:59:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.play.eco/en/index.php?title=Custom_Chat_Commands&amp;diff=16605&amp;oldid=prev</id>
		<title>StalEF at 17:59, 1 April 2026</title>
		<link rel="alternate" type="text/html" href="https://wiki.play.eco/en/index.php?title=Custom_Chat_Commands&amp;diff=16605&amp;oldid=prev"/>
		<updated>2026-04-01T17:59:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:59, 1 April 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{ModdingOutdated}}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A chat command is when the user types messages into chat like /give LogItem, /unstuck, etc.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A chat command is when the user types messages into chat like /give LogItem, /unstuck, etc.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>StalEF</name></author>
	</entry>
	<entry>
		<id>https://wiki.play.eco/en/index.php?title=Custom_Chat_Commands&amp;diff=7556&amp;oldid=prev</id>
		<title>Redwyre: Created page with &quot;{{ModdingOutdated}}  A chat command is when the user types messages into chat like /give LogItem, /unstuck, etc.  You can write custom chat commands easily by implementing the...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.play.eco/en/index.php?title=Custom_Chat_Commands&amp;diff=7556&amp;oldid=prev"/>
		<updated>2021-07-04T17:02:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{ModdingOutdated}}  A chat command is when the user types messages into chat like /give LogItem, /unstuck, etc.  You can write custom chat commands easily by implementing the...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{ModdingOutdated}}&lt;br /&gt;
&lt;br /&gt;
A chat command is when the user types messages into chat like /give LogItem, /unstuck, etc.&lt;br /&gt;
&lt;br /&gt;
You can write custom chat commands easily by implementing the IChatComanndHandler interface on any public class on the server then attaching the ChatCommandAttribute to any static method in that class.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public class MyModCommands : IChatCommandHandler&lt;br /&gt;
    {&lt;br /&gt;
        [ChatCommand(&amp;quot;View your current skill title&amp;quot;)]&lt;br /&gt;
        public static void WhoAmI(User user)&lt;br /&gt;
        {&lt;br /&gt;
            user.Player.SendTemporaryMessage(user.Player.SkillTitle);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ChatCommandAttribute ==&lt;br /&gt;
&lt;br /&gt;
* public ChatCommandAttribute(string command, string helpText, ChatAuthorizationLevel level)&lt;br /&gt;
* public ChatCommandAttribute(string helpText, ChatAuthorizationLevel level)&lt;br /&gt;
* public ChatCommandAttribute(ChatAuthorizationLevel level)&lt;br /&gt;
&lt;br /&gt;
Attach the chat attribute to any static method in a class that implements the IChatCommandHandler interface.&lt;br /&gt;
&lt;br /&gt;
If no command is specified, the command will default to the method name. The following commands are invoked with “/bhop”.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;/bhop&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    [ChatCommand()]&lt;br /&gt;
    public static void Bhop(User user)&lt;br /&gt;
    {&lt;br /&gt;
        user.Player.Client.RPC(&amp;quot;ToggleHopping&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;/bhop&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    [ChatCommand(“bhop”, “hop hop hop”)]&lt;br /&gt;
    public static void DoSomething(User user)&lt;br /&gt;
    {&lt;br /&gt;
        user.Player.Client.RPC(&amp;quot;ToggleHopping&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Chat command methods can take the following types as arguments: &lt;br /&gt;
&lt;br /&gt;
* int&lt;br /&gt;
* float&lt;br /&gt;
* string&lt;br /&gt;
* bool - parsed as int.parse(string input) != 0  &lt;br /&gt;
* User - parsed from the username, guaranteed to not be null.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All of these types are guaranteed to not be null. The chat manager catches null before invoking the command.&lt;br /&gt;
If the first argument is of type User, the command handler assigns that argument to the invoking user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;/dosomething otherUsername&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    [ChatCommand()]&lt;br /&gt;
    public static void DoSomething(User user, User otherUser)&lt;br /&gt;
    {&lt;br /&gt;
        user.Player      // the player invoking the command&lt;br /&gt;
        otherUser.Player // the player defined by the first argument&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;/dosomething 42, myUsername, otherUsername&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    [ChatCommand()]&lt;br /&gt;
    public static void DoSomethingElse(int i, User user, User otherUser)&lt;br /&gt;
    {&lt;br /&gt;
        user.Player      // the player defined by the first argument&lt;br /&gt;
        otherUser.Player // the player defined by the second argument&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Chat command methods support default values in method arguments.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;/dosomething 5_ Or _/dosomething 5, 3.14&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    [ChatCommand()]&lt;br /&gt;
    public static void DoSomething(int number, float value = 0.0f)&lt;br /&gt;
    {&lt;br /&gt;
        number //must be declared by the command&lt;br /&gt;
        value  //player can choose to alter or not&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== /help, /? ==&lt;br /&gt;
&lt;br /&gt;
Chat commands can be given a string to describe their function in the declaration of the ChatCommand attribute. When a player invokes _&amp;quot;/help&amp;quot;_, all commands are written to the notifications log with their help text, if it has any.&lt;br /&gt;
&lt;br /&gt;
If a player invokes &amp;quot;/help dosomething&amp;quot;, the command is written to the notifications log with it&amp;#039;s help text and its syntax.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;quot;/help dosomething&amp;quot;&amp;#039;&amp;#039; Or &amp;#039;&amp;#039;&amp;quot;/? dosomething&amp;quot;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    [ChatCommand(&amp;quot;The best command there ever was&amp;quot;)]&lt;br /&gt;
    public static void DoSomething(int number, string name, float value = 0.0f, bool spawnWithTrees = false)&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This produces the following output in the chatlog. Arguments that have default values appear with an asterisk over their property name.&lt;br /&gt;
&lt;br /&gt;
    dosomething:   The best command there ever was&lt;br /&gt;
    /dosomething number, name, value*, spawnWithTrees*&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Modding]]&lt;/div&gt;</summary>
		<author><name>Redwyre</name></author>
	</entry>
</feed>