mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add support of language files (#1273)
* 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
This commit is contained in:
parent
0c88c18ea0
commit
2017d5d652
54 changed files with 1658 additions and 660 deletions
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Animation : Command
|
||||
{
|
||||
public override string CMDName { get { return "animation"; } }
|
||||
public override string CMDDesc { get { return "animation <mainhand|offhand>"; } }
|
||||
public override string CmdName { get { return "animation"; } }
|
||||
public override string CmdUsage { get { return "animation <mainhand|offhand>"; } }
|
||||
public override string CmdDesc { get { return "cmd.animation.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -20,24 +21,24 @@ namespace MinecraftClient.Commands
|
|||
if (args[0] == "mainhand" || args[0] == "0")
|
||||
{
|
||||
handler.DoAnimation(0);
|
||||
return "Done";
|
||||
return Translations.Get("general.done");
|
||||
}
|
||||
else if (args[0] == "offhand" || args[0] == "1")
|
||||
{
|
||||
handler.DoAnimation(1);
|
||||
return "Done";
|
||||
return Translations.Get("general.done");
|
||||
}
|
||||
else
|
||||
{
|
||||
return CMDDesc;
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return CMDDesc;
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
class ChangeSlot : Command
|
||||
{
|
||||
public override string CMDName { get { return "changeslot"; } }
|
||||
public override string CMDDesc { get { return "changeslot <1-9>: Change hotbar"; } }
|
||||
public override string CmdName { get { return "changeslot"; } }
|
||||
public override string CmdUsage { get { return "changeslot <1-9>"; } }
|
||||
public override string CmdDesc { get { return "cmd.changeSlot.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
if (!handler.GetInventoryEnabled())
|
||||
return "Please enable InventoryHandling in the config file first.";
|
||||
return Translations.Get("extra.inventory_required");
|
||||
|
||||
if (hasArg(command))
|
||||
{
|
||||
|
|
@ -24,21 +25,21 @@ namespace MinecraftClient.Commands
|
|||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
return "Could not change slot: Not a Number";
|
||||
return Translations.Get("cmd.changeSlot.nan");
|
||||
}
|
||||
if (slot >= 1 && slot <= 9)
|
||||
{
|
||||
if (handler.ChangeSlot(slot-=1))
|
||||
{
|
||||
return "Changed to slot " + (slot+=1);
|
||||
return Translations.Get("cmd.changeSlot.changed", (slot+=1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Could not change slot";
|
||||
return Translations.Get("cmd.changeSlot.fail");
|
||||
}
|
||||
}
|
||||
}
|
||||
return CMDDesc;
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Connect : Command
|
||||
{
|
||||
public override string CMDName { get { return "connect"; } }
|
||||
public override string CMDDesc { get { return "connect <server> [account]: connect to the specified server."; } }
|
||||
public override string CmdName { get { return "connect"; } }
|
||||
public override string CmdUsage { get { return "connect <server> [account]"; } }
|
||||
public override string CmdDesc { get { return "cmd.connect.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -19,7 +20,7 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
if (!Settings.SetAccount(args[1]))
|
||||
{
|
||||
return "Unknown account '" + args[1] + "'.";
|
||||
return Translations.Get("cmd.connect.unknown", args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -28,9 +29,9 @@ namespace MinecraftClient.Commands
|
|||
Program.Restart();
|
||||
return "";
|
||||
}
|
||||
else return "Invalid server IP '" + args[0] + "'.";
|
||||
else return Translations.Get("cmd.connect.invalid_ip", args[0]);
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Debug : Command
|
||||
{
|
||||
public override string CMDName { get { return "debug"; } }
|
||||
public override string CMDDesc { get { return "debug [on|off]: toggle debug messages."; } }
|
||||
public override string CmdName { get { return "debug"; } }
|
||||
public override string CmdUsage { get { return "debug [on|off]"; } }
|
||||
public override string CmdDesc { get { return "cmd.debug.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -17,7 +18,7 @@ namespace MinecraftClient.Commands
|
|||
Settings.DebugMessages = (getArg(command).ToLower() == "on");
|
||||
}
|
||||
else Settings.DebugMessages = !Settings.DebugMessages;
|
||||
return "Debug messages are now " + (Settings.DebugMessages ? "ON" : "OFF");
|
||||
return Translations.Get(Settings.DebugMessages ? "cmd.debug.state_on" : "cmd.debug.state_off");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Dig : Command
|
||||
{
|
||||
public override string CMDName { get { return "dig"; } }
|
||||
public override string CMDDesc { get { return "dig <x> <y> <z>: attempt to break a block"; } }
|
||||
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 "Please enable Terrain and Movements to use this command.";
|
||||
return Translations.Get("extra.terrainandmovement_required");
|
||||
|
||||
if (hasArg(command))
|
||||
{
|
||||
|
|
@ -28,18 +29,18 @@ namespace MinecraftClient.Commands
|
|||
int z = int.Parse(args[2]);
|
||||
Location blockToBreak = new Location(x, y, z);
|
||||
if (blockToBreak.DistanceSquared(handler.GetCurrentLocation().EyesLocation()) > 25)
|
||||
return "You are too far away from this block.";
|
||||
return Translations.Get("cmd.dig.too_far");
|
||||
if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air)
|
||||
return "No block at this location (Air)";
|
||||
return Translations.Get("cmd.dig.no_block");
|
||||
if (handler.DigBlock(blockToBreak))
|
||||
return String.Format("Attempting to dig block at {0} {1} {2}", x, y, z);
|
||||
else return "Failed to start digging block.";
|
||||
return Translations.Get("cmd.dig.dig", x, y, z);
|
||||
else return "cmd.dig.fail";
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
class Entitycmd : Command
|
||||
{
|
||||
public override string CMDName { get { return "entity"; } }
|
||||
public override string CMDDesc { get { return "entity <id|entitytype> <attack|use>"; } }
|
||||
public override string CmdName { get { return "entity"; } }
|
||||
public override string CmdUsage { get { return "entity <id|entitytype> <attack|use>"; } }
|
||||
public override string CmdDesc { get { return ""; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -33,10 +34,10 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
case "attack":
|
||||
handler.InteractEntity(entityID, 1);
|
||||
return "Entity attacked";
|
||||
return Translations.Get("cmd.entityCmd.attacked");
|
||||
case "use":
|
||||
handler.InteractEntity(entityID, 0);
|
||||
return "Entity used";
|
||||
return Translations.Get("cmd.entityCmd.used");
|
||||
default:
|
||||
Entity entity = handler.GetEntities()[entityID];
|
||||
int id = entity.ID;
|
||||
|
|
@ -56,52 +57,52 @@ namespace MinecraftClient.Commands
|
|||
color = "§e"; // Yellow
|
||||
|
||||
string location = String.Format("X:{0}, Y:{1}, Z:{2}", Math.Round(entity.Location.X, 2), Math.Round(entity.Location.Y, 2), Math.Round(entity.Location.Y, 2));
|
||||
string done = String.Format("Entity: {0}\n [MCC] Type: {1}", id, type);
|
||||
string done = Translations.Replace("([cmd.entityCmd.entity]): {0}\n [MCC] Type: {1}", id, type);
|
||||
if (!String.IsNullOrEmpty(nickname))
|
||||
done += String.Format("\n [MCC] Nickname: {0}", nickname);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.nickname]): {0}", nickname);
|
||||
else if (!String.IsNullOrEmpty(customname))
|
||||
done += String.Format("\n [MCC] CustomName: {0}§8", customname.Replace("&", "§"));
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.customname]): {0}§8", customname.Replace("&", "§"));
|
||||
if (type == EntityType.Player)
|
||||
done += String.Format("\n [MCC] Latency: {0}", latency);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.latency]): {0}", latency);
|
||||
else if (type == EntityType.Item || type == EntityType.ItemFrame || type == Mapping.EntityType.EyeOfEnder || type == Mapping.EntityType.Egg || type == Mapping.EntityType.EnderPearl || type == Mapping.EntityType.Potion || type == Mapping.EntityType.Fireball || type == Mapping.EntityType.FireworkRocket)
|
||||
{
|
||||
string displayName = item.DisplayName;
|
||||
if (String.IsNullOrEmpty(displayName))
|
||||
done += String.Format("\n [MCC] Item: {0} x{1}", item.Type, item.Count);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1}", item.Type, item.Count);
|
||||
else
|
||||
done += String.Format("\n [MCC] Item: {0} x{1} - {2}§8", item.Type, item.Count, displayName);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.item]): {0} x{1} - {2}§8", item.Type, item.Count, displayName);
|
||||
}
|
||||
|
||||
if (entity.Equipment.Count >= 1 && entity.Equipment != null)
|
||||
{
|
||||
done += String.Format("\n [MCC] Equipment:");
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.equipment]):");
|
||||
if (entity.Equipment.ContainsKey(0) && entity.Equipment[0] != null)
|
||||
done += String.Format("\n [MCC] MainHand: {0} x{1}", entity.Equipment[0].Type, entity.Equipment[0].Count);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.mainhand]): {0} x{1}", entity.Equipment[0].Type, entity.Equipment[0].Count);
|
||||
if (entity.Equipment.ContainsKey(1) && entity.Equipment[1] != null)
|
||||
done += String.Format("\n [MCC] OffHand: {0} x{1}", entity.Equipment[1].Type, entity.Equipment[1].Count);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.offhand]): {0} x{1}", entity.Equipment[1].Type, entity.Equipment[1].Count);
|
||||
if (entity.Equipment.ContainsKey(5) && entity.Equipment[5] != null)
|
||||
done += String.Format("\n [MCC] Helmet: {0} x{1}", entity.Equipment[5].Type, entity.Equipment[5].Count);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.helmet]): {0} x{1}", entity.Equipment[5].Type, entity.Equipment[5].Count);
|
||||
if (entity.Equipment.ContainsKey(4) && entity.Equipment[4] != null)
|
||||
done += String.Format("\n [MCC] Chestplate: {0} x{1}", entity.Equipment[4].Type, entity.Equipment[4].Count);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.chestplate]): {0} x{1}", entity.Equipment[4].Type, entity.Equipment[4].Count);
|
||||
if (entity.Equipment.ContainsKey(3) && entity.Equipment[3] != null)
|
||||
done += String.Format("\n [MCC] Leggings: {0} x{1}", entity.Equipment[3].Type, entity.Equipment[3].Count);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.leggings]): {0} x{1}", entity.Equipment[3].Type, entity.Equipment[3].Count);
|
||||
if (entity.Equipment.ContainsKey(2) && entity.Equipment[2] != null)
|
||||
done += String.Format("\n [MCC] Boots: {0} x{1}", entity.Equipment[2].Type, entity.Equipment[2].Count);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.boots]): {0} x{1}", entity.Equipment[2].Type, entity.Equipment[2].Count);
|
||||
}
|
||||
done += String.Format("\n [MCC] Pose: {0}", pose);
|
||||
done += String.Format("\n [MCC] Health: {0}", color + health + "§8");
|
||||
done += String.Format("\n [MCC] Distance: {0}", distance);
|
||||
done += String.Format("\n [MCC] Location: {0}", location);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.pose]): {0}", pose);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.health]): {0}", color + health + "§8");
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.distance]): {0}", distance);
|
||||
done += Translations.Replace("\n [MCC] ([cmd.entityCmd.location]): {0}", location);
|
||||
return done;
|
||||
}
|
||||
}
|
||||
else return "Entity not found";
|
||||
else return Translations.Get("cmd.entityCmd.not_found");
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityType interacttype = EntityType.Player;
|
||||
Enum.TryParse(args[0], out interacttype);
|
||||
string actionst = "Entity attacked";
|
||||
string actionst = "cmd.entityCmd.attacked";
|
||||
int actioncount = 0;
|
||||
foreach (var entity2 in handler.GetEntities())
|
||||
{
|
||||
|
|
@ -113,28 +114,28 @@ namespace MinecraftClient.Commands
|
|||
if (action == "attack")
|
||||
{
|
||||
handler.InteractEntity(entity2.Key, 1);
|
||||
actionst = "Entity attacked";
|
||||
actionst = "cmd.entityCmd.attacked";
|
||||
actioncount++;
|
||||
}
|
||||
else if (action == "use")
|
||||
{
|
||||
handler.InteractEntity(entity2.Key, 0);
|
||||
actionst = "Entity used";
|
||||
actionst = "cmd.entityCmd.used";
|
||||
actioncount++;
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
return actioncount + " " + actionst;
|
||||
return actioncount + " " + Translations.Get(actionst);
|
||||
}
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<int, Mapping.Entity> entities = handler.GetEntities();
|
||||
Dictionary<int, Entity> entities = handler.GetEntities();
|
||||
List<string> response = new List<string>();
|
||||
response.Add("Entities:");
|
||||
response.Add(Translations.Get("cmd.entityCmd.entities"));
|
||||
foreach (var entity2 in entities)
|
||||
{
|
||||
int id = entity2.Key;
|
||||
|
|
@ -147,20 +148,20 @@ namespace MinecraftClient.Commands
|
|||
Item item = entity2.Value.Item;
|
||||
string location = String.Format("X:{0}, Y:{1}, Z:{2}", Math.Round(entity2.Value.Location.X, 2), Math.Round(entity2.Value.Location.Y, 2), Math.Round(entity2.Value.Location.Y, 2));
|
||||
|
||||
if (type == EntityType.Item || type == EntityType.ItemFrame || type == Mapping.EntityType.EyeOfEnder || type == Mapping.EntityType.Egg || type == Mapping.EntityType.EnderPearl || type == Mapping.EntityType.Potion || type == Mapping.EntityType.Fireball || type == Mapping.EntityType.FireworkRocket)
|
||||
response.Add(String.Format(" #{0}: Type: {1}, Item: {2}, Location: {3}", id, type, item.Type, location));
|
||||
else if (type == Mapping.EntityType.Player && !String.IsNullOrEmpty(nickname))
|
||||
response.Add(String.Format(" #{0}: Type: {1}, Nickname: §8{2}§8, Latency: {3}, Health: {4}, Pose: {5}, Location: {6}", id, type, nickname, latency, health, pose, location));
|
||||
else if (type == Mapping.EntityType.Player && !String.IsNullOrEmpty(customname))
|
||||
response.Add(String.Format(" #{0}: Type: {1}, CustomName: §8{2}§8, Latency: {3}, Health: {4}, Pose: {5}, Location: {6}", id, type, customname.Replace("&", "§"), latency, health, pose, location));
|
||||
if (type == EntityType.Item || type == EntityType.ItemFrame || type == EntityType.EyeOfEnder || type == EntityType.Egg || type == EntityType.EnderPearl || type == EntityType.Potion || type == EntityType.Fireball || type == EntityType.FireworkRocket)
|
||||
response.Add(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.item]): {2}, ([cmd.entityCmd.location]): {3}", id, type, item.Type, location));
|
||||
else if (type == EntityType.Player && !String.IsNullOrEmpty(nickname))
|
||||
response.Add(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.nickname]): §8{2}§8, ([cmd.entityCmd.latency]): {3}, ([cmd.entityCmd.health]): {4}, ([cmd.entityCmd.pose]): {5}, ([cmd.entityCmd.location]): {6}", id, type, nickname, latency, health, pose, location));
|
||||
else if (type == EntityType.Player && !String.IsNullOrEmpty(customname))
|
||||
response.Add(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.customname]): §8{2}§8, ([cmd.entityCmd.latency]): {3}, ([cmd.entityCmd.health]): {4}, ([cmd.entityCmd.pose]): {5}, ([cmd.entityCmd.location]): {6}", id, type, customname.Replace("&", "§"), latency, health, pose, location));
|
||||
else
|
||||
response.Add(String.Format(" #{0}: Type: {1}, Health: {2}, Location: {3}", id, type, health, location));
|
||||
response.Add(Translations.Replace(" #{0}: ([cmd.entityCmd.type]): {1}, ([cmd.entityCmd.health]): {2}, ([cmd.entityCmd.location]): {3}", id, type, health, location));
|
||||
}
|
||||
response.Add(CMDDesc);
|
||||
response.Add(GetCmdDescTranslated());
|
||||
return String.Join("\n", response);
|
||||
}
|
||||
}
|
||||
else return "Please enable entityhandling in config to use this command.";
|
||||
else return Translations.Get("extra.entity_required");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Exit : Command
|
||||
{
|
||||
public override string CMDName { get { return "exit"; } }
|
||||
public override string CMDDesc { get { return "exit: disconnect from the server."; } }
|
||||
public override string CmdName { get { return "exit"; } }
|
||||
public override string CmdUsage { get { return "exit"; } }
|
||||
public override string CmdDesc { get { return "cmd.exit.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
class Health : Command
|
||||
{
|
||||
public override string CMDName { get { return "health"; } }
|
||||
public override string CMDDesc { get { return "health: Display Health and Food saturation."; } }
|
||||
public override string CmdName { get { return "health"; } }
|
||||
public override string CmdUsage { get { return "health"; } }
|
||||
public override string CmdDesc { get { return "cmd.health.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
return "Health: " + handler.GetHealth() + ", Saturation: " + handler.GetSaturation() + ", Level: " + handler.GetLevel() + ", TotalExperience: " + handler.GetTotalExperience();
|
||||
return Translations.Get("cmd.health.response", handler.GetHealth(), handler.GetSaturation(), handler.GetLevel(), handler.GetTotalExperience());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
class Inventory : Command
|
||||
{
|
||||
public override string CMDName { get { return "inventory"; } }
|
||||
public override string CMDDesc { get { return GetCommandDesc(); } }
|
||||
public override string CmdName { get { return "inventory"; } }
|
||||
public override string CmdUsage { get { return GetBasicUsage(); } }
|
||||
public override string CmdDesc { get { return "cmd.inventory.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -32,17 +33,17 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
int count = int.Parse(args[3]);
|
||||
if (handler.DoCreativeGive(slot, itemType, count, null))
|
||||
return "Requested " + itemType + " x" + count + " in slot #" + slot;
|
||||
else return "Failed to request Creative Give";
|
||||
return Translations.Get("cmd.inventory.creative_done", itemType, count, slot);
|
||||
else return Translations.Get("cmd.inventory.creative_fail");
|
||||
}
|
||||
else return "You need Gamemode Creative";
|
||||
else return Translations.Get("cmd.inventory.need_creative");
|
||||
}
|
||||
else
|
||||
{
|
||||
return CMDDesc;
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
else if (args[0].ToLower().StartsWith("p"))
|
||||
{
|
||||
|
|
@ -55,7 +56,7 @@ namespace MinecraftClient.Commands
|
|||
availableIds.Remove(0); // remove player inventory ID from list
|
||||
if (availableIds.Count == 1)
|
||||
inventoryId = availableIds[0]; // one container, use it
|
||||
else return "Cannot find container, please retry with explicit ID";
|
||||
else return Translations.Get("cmd.inventory.container_not_found");
|
||||
}
|
||||
else if (args[0].ToLower() == "help")
|
||||
{
|
||||
|
|
@ -73,65 +74,65 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
case "close":
|
||||
if (handler.CloseInventory(inventoryId))
|
||||
return "Closing Inventoy #" + inventoryId;
|
||||
else return "Failed to close Inventory #" + inventoryId;
|
||||
return Translations.Get("cmd.inventory.close", inventoryId);
|
||||
else return Translations.Get("cmd.inventory.close_fail", inventoryId);
|
||||
case "list":
|
||||
Container inventory = handler.GetInventory(inventoryId);
|
||||
if(inventory==null)
|
||||
return "Inventory #" + inventoryId + " do not exist";
|
||||
return Translations.Get("cmd.inventory.not_exist", inventoryId);
|
||||
List<string> response = new List<string>();
|
||||
response.Add("Inventory #" + inventoryId + " - " + inventory.Title + "§8");
|
||||
response.Add(Translations.Get("cmd.inventory.inventory") + " #" + inventoryId + " - " + inventory.Title + "§8");
|
||||
foreach (KeyValuePair<int, Item> item in inventory.Items)
|
||||
{
|
||||
string displayName = item.Value.DisplayName;
|
||||
if (String.IsNullOrEmpty(displayName))
|
||||
{
|
||||
if (item.Value.Damage != 0)
|
||||
response.Add(String.Format(" #{0}: {1} x{2} | Damage: {3}", item.Key, item.Value.Type, item.Value.Count, item.Value.Damage));
|
||||
response.Add(String.Format(" #{0}: {1} x{2} | {3}: {4}", item.Key, item.Value.Type, item.Value.Count, Translations.Get("cmd.inventory.damage"), item.Value.Damage));
|
||||
else
|
||||
response.Add(String.Format(" #{0}: {1} x{2}", item.Key, item.Value.Type, item.Value.Count));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Value.Damage != 0)
|
||||
response.Add(String.Format(" #{0}: {1} x{2} - {3}§8 | Damage: {4}", item.Key, item.Value.Type, item.Value.Count, displayName, item.Value.Damage));
|
||||
response.Add(String.Format(" #{0}: {1} x{2} - {3}§8 | {4}: {5}", item.Key, item.Value.Type, item.Value.Count, displayName, Translations.Get("cmd.inventory.damage"), item.Value.Damage));
|
||||
else
|
||||
response.Add(String.Format(" #{0}: {1} x{2} - {3}§8", item.Key, item.Value.Type, item.Value.Count, displayName));
|
||||
}
|
||||
}
|
||||
if (inventoryId == 0) response.Add("Your selected hotbar is " + (handler.GetCurrentSlot() + 1));
|
||||
if (inventoryId == 0) response.Add(Translations.Get("cmd.inventory.hotbar", (handler.GetCurrentSlot() + 1)));
|
||||
return String.Join("\n", response.ToArray());
|
||||
case "click":
|
||||
if (args.Length >= 3)
|
||||
{
|
||||
int slot = int.Parse(args[2]);
|
||||
WindowActionType actionType = WindowActionType.LeftClick;
|
||||
string keyName = "Left";
|
||||
string keyName = "cmd.inventory.left";
|
||||
if (args.Length >= 4)
|
||||
{
|
||||
string b = args[3];
|
||||
if (b.ToLower()[0] == 'r')
|
||||
{
|
||||
actionType = WindowActionType.RightClick;
|
||||
keyName = "Right";
|
||||
keyName = "cmd.inventory.right";
|
||||
}
|
||||
if (b.ToLower()[0] == 'm')
|
||||
{
|
||||
actionType = WindowActionType.MiddleClick;
|
||||
keyName = "Middle";
|
||||
keyName = "cmd.inventory.middle";
|
||||
}
|
||||
}
|
||||
handler.DoWindowAction(inventoryId, slot, actionType);
|
||||
return keyName + " clicking slot " + slot + " in window #" + inventoryId;
|
||||
return Translations.Get("cmd.inventory.clicking", Translations.Get(keyName), slot, inventoryId);
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return CmdUsage;
|
||||
case "drop":
|
||||
if (args.Length >= 3)
|
||||
{
|
||||
int slot = int.Parse(args[2]);
|
||||
// check item exist
|
||||
if (!handler.GetInventory(inventoryId).Items.ContainsKey(slot))
|
||||
return "No item in slot #" + slot;
|
||||
return Translations.Get("cmd.inventory.no_item", slot);
|
||||
WindowActionType actionType = WindowActionType.DropItem;
|
||||
if (args.Length >= 4)
|
||||
{
|
||||
|
|
@ -143,35 +144,35 @@ namespace MinecraftClient.Commands
|
|||
if (handler.DoWindowAction(inventoryId, slot, actionType))
|
||||
{
|
||||
if (actionType == WindowActionType.DropItemStack)
|
||||
return "Dropped whole item stack from slot #" + slot;
|
||||
else return "Dropped 1 item from slot #" + slot;
|
||||
return Translations.Get("cmd.inventory.drop_stack", slot);
|
||||
else return Translations.Get("cmd.inventory.drop", slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Failed";
|
||||
}
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
default:
|
||||
return CMDDesc;
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<int, Container> inventories = handler.GetInventories();
|
||||
List<string> response = new List<string>();
|
||||
response.Add("Inventories:");
|
||||
response.Add(Translations.Get("cmd.inventory.inventories") + ":");
|
||||
foreach (KeyValuePair<int, Container> inventory in inventories)
|
||||
{
|
||||
response.Add(String.Format(" #{0}: {1}", inventory.Key, inventory.Value.Title + "§8"));
|
||||
}
|
||||
response.Add(CMDDesc);
|
||||
response.Add(CmdUsage);
|
||||
return String.Join("\n", response);
|
||||
}
|
||||
}
|
||||
else return "Please enable inventoryhandling in config to use this command.";
|
||||
else return Translations.Get("extra.inventory_required");
|
||||
}
|
||||
|
||||
#region Methods for commands help
|
||||
|
|
@ -182,26 +183,22 @@ namespace MinecraftClient.Commands
|
|||
|
||||
private string GetAvailableActions()
|
||||
{
|
||||
return "Available actions: list, close, click, drop.";
|
||||
return Translations.Get("cmd.inventory.help.available") + ": list, close, click, drop.";
|
||||
}
|
||||
|
||||
private string GetBasicUsage()
|
||||
{
|
||||
return "Basic usage: /inventory <player|container|<id>> <action>.";
|
||||
return Translations.Get("cmd.inventory.help.basic") + ": /inventory <player|container|<id>> <action>.";
|
||||
}
|
||||
|
||||
private string GetHelp()
|
||||
{
|
||||
return GetBasicUsage()
|
||||
+ "\n " + GetAvailableActions() + " Use \"/inventory help <action>\" for action help."
|
||||
+ "\n Creative mode give: " + GetCreativeGiveHelp()
|
||||
+ "\n \"player\" and \"container\" can be simplified to \"p\" and \"c\"."
|
||||
+ "\n Note that parameters in \"[]\" are optional.";
|
||||
return Translations.Get("cmd.inventory.help.help", GetAvailableActions(), GetCreativeGiveHelp());
|
||||
}
|
||||
|
||||
private string GetCreativeGiveHelp()
|
||||
{
|
||||
return "Usage: /inventory creativegive <slot> <itemtype> <count>";
|
||||
return Translations.Get("cmd.inventory.help.usage") + ": /inventory creativegive <slot> <itemtype> <count>";
|
||||
}
|
||||
|
||||
private string GetSubCommandHelp(string cmd)
|
||||
|
|
@ -209,17 +206,17 @@ namespace MinecraftClient.Commands
|
|||
switch (cmd)
|
||||
{
|
||||
case "list":
|
||||
return "List your inventory. Usage: /inventory <player|container|<id>> list";
|
||||
return Translations.Get("cmd.inventory.help.list") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> list";
|
||||
case "close":
|
||||
return "Close an opened container. Usage: /inventory <player|container|<id>> close";
|
||||
return Translations.Get("cmd.inventory.help.close") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> close";
|
||||
case "click":
|
||||
return "Click on an item. Usage: /inventory <player|container|<id>> click <slot> [left|right|middle]. \nDefault is left click";
|
||||
return Translations.Get("cmd.inventory.help.click") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> click <slot> [left|right|middle]. \nDefault is left click";
|
||||
case "drop":
|
||||
return "Drop an item from inventory. Usage: /inventory <player|container|<id>> drop <slot> [all]. \nAll means drop full stack";
|
||||
return Translations.Get("cmd.inventory.help.drop") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> drop <slot> [all]. \nAll means drop full stack";
|
||||
case "help":
|
||||
return GetHelp();
|
||||
default:
|
||||
return "Unknown action. " + GetAvailableActions();
|
||||
return Translations.Get("cmd.inventory.help.unknown") + GetAvailableActions();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class List : Command
|
||||
{
|
||||
public override string CMDName { get { return "list"; } }
|
||||
public override string CMDDesc { get { return "list: get the player list."; } }
|
||||
public override string CmdName { get { return "list"; } }
|
||||
public override string CmdUsage { get { return "list"; } }
|
||||
public override string CmdDesc { get { return "cmd.list.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
return "PlayerList: " + String.Join(", ", handler.GetOnlinePlayers());
|
||||
return Translations.Get("cmd.list.players", String.Join(", ", handler.GetOnlinePlayers()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Log : Command
|
||||
{
|
||||
public override string CMDName { get { return "log"; } }
|
||||
public override string CMDDesc { get { return "log <text>: log some text to the console."; } }
|
||||
public override string CmdName { get { return "log"; } }
|
||||
public override string CmdUsage { get { return "log <text>"; } }
|
||||
public override string CmdDesc { get { return "cmd.log.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -17,7 +18,7 @@ namespace MinecraftClient.Commands
|
|||
ConsoleIO.WriteLogLine(getArg(command));
|
||||
return "";
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Look : Command
|
||||
{
|
||||
public override string CMDName { get { return "look"; } }
|
||||
public override string CMDDesc { get { return "look <x y z|yaw pitch|up|down|east|west|north|south>: look at direction or coordinates."; } }
|
||||
public override string CmdName { get { return "look"; } }
|
||||
public override string CmdUsage { get { return "look <x y z|yaw pitch|up|down|east|west|north|south>"; } }
|
||||
public override string CmdDesc { get { return "cmd.look.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -28,7 +29,7 @@ namespace MinecraftClient.Commands
|
|||
case "west": direction = Direction.West; break;
|
||||
case "north": direction = Direction.North; break;
|
||||
case "south": direction = Direction.South; break;
|
||||
default: return "Unknown direction '" + dirStr + "'.";
|
||||
default: return Translations.Get("cmd.look.unknown", dirStr);
|
||||
}
|
||||
|
||||
handler.UpdateLocation(handler.GetCurrentLocation(), direction);
|
||||
|
|
@ -42,9 +43,9 @@ namespace MinecraftClient.Commands
|
|||
float pitch = Single.Parse(args[1]);
|
||||
|
||||
handler.UpdateLocation(handler.GetCurrentLocation(), yaw, pitch);
|
||||
return String.Format("Looking at YAW: {0} PITCH: {1}", yaw.ToString("0.00"), pitch.ToString("0.00"));
|
||||
return Translations.Get("cmd.look.at", yaw.ToString("0.00"), pitch.ToString("0.00"));
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
}
|
||||
else if (args.Length == 3)
|
||||
{
|
||||
|
|
@ -57,14 +58,14 @@ namespace MinecraftClient.Commands
|
|||
Location block = new Location(x, y, z);
|
||||
handler.UpdateLocation(handler.GetCurrentLocation(), block);
|
||||
|
||||
return "Looking at " + block;
|
||||
return Translations.Get("cmd.look.block", block);
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
catch (FormatException) { return CmdUsage; }
|
||||
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
else return "Please enable terrainandmovements in config to use this command.";
|
||||
else return Translations.Get("extra.terrainandmovement_required");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Move : Command
|
||||
{
|
||||
public override string CMDName { get { return "move"; } }
|
||||
public override string CMDDesc { get { return "move <on|off|get|up|down|east|west|north|south|x y z>: walk or start walking."; } }
|
||||
public override string CmdName { get { return "move"; } }
|
||||
public override string CmdUsage { get { return "move <on|off|get|up|down|east|west|north|south|x y z>"; } }
|
||||
public override string CmdDesc { get { return "walk or start walking."; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -19,12 +20,12 @@ namespace MinecraftClient.Commands
|
|||
if (argStr == "on")
|
||||
{
|
||||
handler.SetTerrainEnabled(true);
|
||||
return "Enabling Terrain and Movements on next server login, respawn or world change.";
|
||||
return Translations.Get("cmd.move.enable");
|
||||
}
|
||||
else if (argStr == "off")
|
||||
{
|
||||
handler.SetTerrainEnabled(false);
|
||||
return "Disabling Terrain and Movements.";
|
||||
return Translations.Get("cmd.move.disable");
|
||||
}
|
||||
else if (handler.GetTerrainEnabled())
|
||||
{
|
||||
|
|
@ -40,14 +41,14 @@ namespace MinecraftClient.Commands
|
|||
case "north": direction = Direction.North; break;
|
||||
case "south": direction = Direction.South; break;
|
||||
case "get": return handler.GetCurrentLocation().ToString();
|
||||
default: return "Unknown direction '" + argStr + "'.";
|
||||
default: return Translations.Get("cmd.look.unknown", argStr);
|
||||
}
|
||||
if (Movement.CanMove(handler.GetWorld(), handler.GetCurrentLocation(), direction))
|
||||
{
|
||||
handler.MoveTo(Movement.Move(handler.GetCurrentLocation(), direction));
|
||||
return "Moving " + argStr + '.';
|
||||
return Translations.Get("cmd.move.moving", argStr);
|
||||
}
|
||||
else return "Cannot move in that direction.";
|
||||
else return Translations.Get("cmd.move.dir_fail");
|
||||
}
|
||||
else if (args.Length == 3)
|
||||
{
|
||||
|
|
@ -58,14 +59,14 @@ namespace MinecraftClient.Commands
|
|||
int z = int.Parse(args[2]);
|
||||
Location goal = new Location(x, y, z);
|
||||
if (handler.MoveTo(goal))
|
||||
return "Walking to " + goal;
|
||||
return "Failed to compute path to " + goal;
|
||||
return Translations.Get("cmd.move.walk", goal);
|
||||
return Translations.Get("cmd.move.fail", goal);
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
else return "Please enable terrainandmovements to use this command.";
|
||||
else return Translations.Get("extra.terrainandmovement_required");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Reco : Command
|
||||
{
|
||||
public override string CMDName { get { return "reco"; } }
|
||||
public override string CMDDesc { get { return "reco [account]: restart and reconnect to the server."; } }
|
||||
public override string CmdName { get { return "reco"; } }
|
||||
public override string CmdUsage { get { return "reco [account]"; } }
|
||||
public override string CmdDesc { get { return "cmd.reco.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -17,7 +18,7 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
if (!Settings.SetAccount(args[0]))
|
||||
{
|
||||
return "Unknown account '" + args[0] + "'.";
|
||||
return Translations.Get("cmd.connect.unknown", args[0]);
|
||||
}
|
||||
}
|
||||
Program.Restart();
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Respawn : Command
|
||||
{
|
||||
public override string CMDName { get { return "respawn"; } }
|
||||
public override string CMDDesc { get { return "respawn: Use this to respawn if you are dead."; } }
|
||||
public override string CmdName { get { return "respawn"; } }
|
||||
public override string CmdUsage { get { return "respawn"; } }
|
||||
public override string CmdDesc { get { return "cmd.respawn.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
handler.SendRespawnPacket();
|
||||
return "You have respawned.";
|
||||
return Translations.Get("cmd.respawn.done");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Script : Command
|
||||
{
|
||||
public override string CMDName { get { return "script"; } }
|
||||
public override string CMDDesc { get { return "script <scriptname>: run a script file."; } }
|
||||
public override string CmdName { get { return "script"; } }
|
||||
public override string CmdUsage { get { return "script <scriptname>"; } }
|
||||
public override string CmdDesc { get { return "cmd.script.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -17,7 +18,7 @@ namespace MinecraftClient.Commands
|
|||
handler.BotLoad(new ChatBots.Script(getArg(command), null, localVars));
|
||||
return "";
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Send : Command
|
||||
{
|
||||
public override string CMDName { get { return "send"; } }
|
||||
public override string CMDDesc { get { return "send <text>: send a chat message or command."; } }
|
||||
public override string CmdName { get { return "send"; } }
|
||||
public override string CmdUsage { get { return "send <text>"; } }
|
||||
public override string CmdDesc { get { return "cmd.send.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -17,7 +18,7 @@ namespace MinecraftClient.Commands
|
|||
handler.SendText(getArg(command));
|
||||
return "";
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Set : Command
|
||||
{
|
||||
public override string CMDName { get { return "set"; } }
|
||||
public override string CMDDesc { get { return "set varname=value: set a custom %variable%."; } }
|
||||
public override string CmdName { get { return "set"; } }
|
||||
public override string CmdUsage { get { return "set varname=value"; } }
|
||||
public override string CmdDesc { get { return "cmd.set.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -21,11 +22,11 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
return ""; //Success
|
||||
}
|
||||
else return "variable name must be A-Za-z0-9.";
|
||||
else return Translations.Get("cmd.set.format");
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
else return CMDDesc;
|
||||
else return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ namespace MinecraftClient.Commands
|
|||
public class Sneak : Command
|
||||
{
|
||||
private bool sneaking = false;
|
||||
public override string CMDName { get { return "Sneak"; } }
|
||||
public override string CMDDesc { get { return "Sneak: Toggles sneaking"; } }
|
||||
public override string CmdName { get { return "Sneak"; } }
|
||||
public override string CmdUsage { get { return "Sneak"; } }
|
||||
public override string CmdDesc { get { return "cmd.sneak.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -18,14 +19,14 @@ namespace MinecraftClient.Commands
|
|||
var result = handler.SendEntityAction(Protocol.EntityActionType.StopSneaking);
|
||||
if (result)
|
||||
sneaking = false;
|
||||
return result ? "You aren't sneaking anymore" : "Fail";
|
||||
return Translations.Get(result ? "cmd.sneak.off" : "general.fail");
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = handler.SendEntityAction(Protocol.EntityActionType.StartSneaking);
|
||||
if (result)
|
||||
sneaking = true;
|
||||
return result ? "You are sneaking now" : "Fail";
|
||||
return Translations.Get(result ? "cmd.sneak.on" : "general.fail");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
class Tps : Command
|
||||
{
|
||||
public override string CMDName { get { return "tps"; } }
|
||||
public override string CMDDesc { get { return "Display server current tps (tick per second). May not be accurate"; } }
|
||||
public override string CmdName { get { return "tps"; } }
|
||||
public override string CmdUsage { get { return "tps"; } }
|
||||
public override string CmdDesc { get { return "cmd.tps.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
|
|
@ -19,7 +20,7 @@ namespace MinecraftClient.Commands
|
|||
else if (tps < 15)
|
||||
color = "§e"; // Yellow
|
||||
else color = "§a"; // Green
|
||||
return "Current tps: " + color + tps;
|
||||
return Translations.Get("cmd.tps.current") + ": " + color + tps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,17 +7,18 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
class UseItem : Command
|
||||
{
|
||||
public override string CMDName { get { return "useitem"; } }
|
||||
public override string CMDDesc { get { return "useitem: Use (left click) an item on the hand"; } }
|
||||
public override string CmdName { get { return "useitem"; } }
|
||||
public override string CmdUsage { get { return "useitem"; } }
|
||||
public override string CmdDesc { get { return "cmd.useitem.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
if (handler.GetInventoryEnabled())
|
||||
{
|
||||
handler.UseItemOnHand();
|
||||
return "Used an item";
|
||||
return Translations.Get("cmd.useitem.use");
|
||||
}
|
||||
else return "Please enable inventoryhandling in config to use this command.";
|
||||
else return Translations.Get("extra.inventory_required");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
class Useblock : Command
|
||||
{
|
||||
public override string CMDName { get { return "useblock"; } }
|
||||
public override string CMDDesc { get { return "useblock <x> <y> <z>: use block"; } }
|
||||
public override string CmdName { get { return "useblock"; } }
|
||||
public override string CmdUsage { get { return "useblock <x> <y> <z>"; } }
|
||||
public override string CmdDesc { get { return "cmd.useblock.desc"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
if (!handler.GetTerrainEnabled()) return "Please enable TerrainHandling in the config file first.";
|
||||
if (!handler.GetTerrainEnabled()) return Translations.Get("extra.terrainandmovement_required");
|
||||
if (hasArg(command))
|
||||
{
|
||||
string[] args = getArgs(command);
|
||||
|
|
@ -24,9 +25,9 @@ namespace MinecraftClient.Commands
|
|||
int z = Convert.ToInt32(args[2]);
|
||||
handler.PlaceBlock(new Location(x, y, z), Direction.Down);
|
||||
}
|
||||
else { return CMDDesc; }
|
||||
else { return GetCmdDescTranslated(); }
|
||||
}
|
||||
return CMDDesc;
|
||||
return GetCmdDescTranslated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue