2020-05-01 08:28:22 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Commands
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Sneak : Command
|
|
|
|
|
|
{
|
|
|
|
|
|
private bool sneaking = false;
|
2020-05-03 11:19:22 -05:00
|
|
|
|
public override string CMDName { get { return "Sneak"; } }
|
2020-05-01 08:28:22 -05:00
|
|
|
|
public override string CMDDesc { get { return "Sneak: Toggles sneaking"; } }
|
|
|
|
|
|
|
|
|
|
|
|
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sneaking)
|
|
|
|
|
|
{
|
2020-05-03 11:21:34 -05:00
|
|
|
|
var result = handler.sendEntityAction(Protocol.EntityActionType.StopSneaking);
|
2020-05-23 21:20:33 +08:00
|
|
|
|
if (result)
|
|
|
|
|
|
sneaking = false;
|
2020-05-23 21:16:28 +08:00
|
|
|
|
return result ? "You aren't sneaking anymore" : "Fail";
|
2020-05-01 08:28:22 -05:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-05-03 11:21:34 -05:00
|
|
|
|
var result = handler.sendEntityAction(Protocol.EntityActionType.StartSneaking);
|
2020-05-23 21:20:33 +08:00
|
|
|
|
if (result)
|
|
|
|
|
|
sneaking = true;
|
2020-05-23 21:16:28 +08:00
|
|
|
|
return result ? "You are sneaking now" : "Fail";
|
2020-05-01 08:28:22 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|