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-10-17 19:41:31 +08:00
|
|
|
|
public override string CmdName { get { return "Sneak"; } }
|
|
|
|
|
|
public override string CmdUsage { get { return "Sneak"; } }
|
|
|
|
|
|
public override string CmdDesc { get { return "cmd.sneak.desc"; } }
|
2020-05-01 08:28:22 -05:00
|
|
|
|
|
2020-06-20 15:01:16 +02:00
|
|
|
|
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
2020-05-01 08:28:22 -05:00
|
|
|
|
{
|
|
|
|
|
|
if (sneaking)
|
|
|
|
|
|
{
|
2020-06-20 15:18:34 +02:00
|
|
|
|
var result = handler.SendEntityAction(Protocol.EntityActionType.StopSneaking);
|
2020-05-23 21:20:33 +08:00
|
|
|
|
if (result)
|
|
|
|
|
|
sneaking = false;
|
2020-10-17 19:41:31 +08:00
|
|
|
|
return Translations.Get(result ? "cmd.sneak.off" : "general.fail");
|
2020-05-01 08:28:22 -05:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-06-20 15:18:34 +02:00
|
|
|
|
var result = handler.SendEntityAction(Protocol.EntityActionType.StartSneaking);
|
2020-05-23 21:20:33 +08:00
|
|
|
|
if (result)
|
|
|
|
|
|
sneaking = true;
|
2020-10-17 19:41:31 +08:00
|
|
|
|
return Translations.Get(result ? "cmd.sneak.on" : "general.fail");
|
2020-05-01 08:28:22 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|