mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
* Basic support of language file Only mapped main part of MCC. * Translations function imporve * Change translation file naming * Fix default translation file naming * Complete translation file mapping for main part Command and ChatBot not done yet * Complete translation mapping for commands Except Entitycmd * Complete translation mapping for ChatBots * Add new method for replacing translation key Just for Entitycmd. Be proud of yourself. We have a convenient method now. * Complete all translation mapping * Add default config and translation file to resource * Remove untranslatable messages from default translation file
46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using MinecraftClient.Mapping;
|
|
|
|
namespace MinecraftClient.Commands
|
|
{
|
|
public class Dig : Command
|
|
{
|
|
public override string CmdName { get { return "dig"; } }
|
|
public override string CmdUsage { get { return "dig <x> <y> <z>"; } }
|
|
public override string CmdDesc { get { return "cmd.dig.desc"; } }
|
|
|
|
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
|
{
|
|
if (!handler.GetTerrainEnabled())
|
|
return Translations.Get("extra.terrainandmovement_required");
|
|
|
|
if (hasArg(command))
|
|
{
|
|
string[] args = getArgs(command);
|
|
if (args.Length == 3)
|
|
{
|
|
try
|
|
{
|
|
int x = int.Parse(args[0]);
|
|
int y = int.Parse(args[1]);
|
|
int z = int.Parse(args[2]);
|
|
Location blockToBreak = new Location(x, y, z);
|
|
if (blockToBreak.DistanceSquared(handler.GetCurrentLocation().EyesLocation()) > 25)
|
|
return Translations.Get("cmd.dig.too_far");
|
|
if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air)
|
|
return Translations.Get("cmd.dig.no_block");
|
|
if (handler.DigBlock(blockToBreak))
|
|
return Translations.Get("cmd.dig.dig", x, y, z);
|
|
else return "cmd.dig.fail";
|
|
}
|
|
catch (FormatException) { return GetCmdDescTranslated(); }
|
|
}
|
|
else return GetCmdDescTranslated();
|
|
}
|
|
else return GetCmdDescTranslated();
|
|
}
|
|
}
|
|
}
|