mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add command to turn on and off auto attack
This commit is contained in:
parent
8c31c04c3e
commit
850eae86d7
2 changed files with 47 additions and 1 deletions
46
MinecraftClient/Commands/AutoAttack.cs
Normal file
46
MinecraftClient/Commands/AutoAttack.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Commands
|
||||||
|
{
|
||||||
|
class AutoAttack : Command
|
||||||
|
{
|
||||||
|
public override string CMDName { get { return "autoattack"; } }
|
||||||
|
public override string CMDDesc { get { return "autoattack <on|off>: Enable/disable auto attack mobs."; } }
|
||||||
|
|
||||||
|
public override string Run(McTcpClient handler, string command)
|
||||||
|
{
|
||||||
|
if (hasArg(command))
|
||||||
|
{
|
||||||
|
string state = getArg(command);
|
||||||
|
if (state.ToLower() == "on")
|
||||||
|
{
|
||||||
|
if (!handler.AutoAttack)
|
||||||
|
{
|
||||||
|
handler.AutoAttack = true;
|
||||||
|
return "Auto attack turned on.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "Auto attack is on.";
|
||||||
|
}
|
||||||
|
}else if (state.ToLower() == "off")
|
||||||
|
{
|
||||||
|
if (handler.AutoAttack)
|
||||||
|
{
|
||||||
|
handler.AutoAttack = false;
|
||||||
|
return "Auto attack turned off.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "Auto attack is off.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else return CMDDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -79,7 +79,6 @@
|
||||||
<Compile Include="ChatBots\AutoRelog.cs" />
|
<Compile Include="ChatBots\AutoRelog.cs" />
|
||||||
<Compile Include="ChatBots\ChatLog.cs" />
|
<Compile Include="ChatBots\ChatLog.cs" />
|
||||||
<Compile Include="ChatBots\HangmanGame.cs" />
|
<Compile Include="ChatBots\HangmanGame.cs" />
|
||||||
<Compile Include="ChatBots\kill.cs" />
|
|
||||||
<Compile Include="ChatBots\PlayerListLogger.cs" />
|
<Compile Include="ChatBots\PlayerListLogger.cs" />
|
||||||
<Compile Include="ChatBots\RemoteControl.cs" />
|
<Compile Include="ChatBots\RemoteControl.cs" />
|
||||||
<Compile Include="ChatBots\Script.cs" />
|
<Compile Include="ChatBots\Script.cs" />
|
||||||
|
|
@ -87,6 +86,7 @@
|
||||||
<Compile Include="ChatBots\TestBot.cs" />
|
<Compile Include="ChatBots\TestBot.cs" />
|
||||||
<Compile Include="ChatBot.cs" />
|
<Compile Include="ChatBot.cs" />
|
||||||
<Compile Include="Command.cs" />
|
<Compile Include="Command.cs" />
|
||||||
|
<Compile Include="Commands\AutoAttack.cs" />
|
||||||
<Compile Include="Commands\Connect.cs" />
|
<Compile Include="Commands\Connect.cs" />
|
||||||
<Compile Include="Commands\Debug.cs" />
|
<Compile Include="Commands\Debug.cs" />
|
||||||
<Compile Include="Commands\Look.cs" />
|
<Compile Include="Commands\Look.cs" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue