public void Execute(string text) { if (Utils.CaselessStarts(text, prefix)) { text = text.Substring(prefix.Length).TrimStart(' '); text = "/" + text; } CommandReader reader = new CommandReader(text); string cmdName = reader.Next(); if (cmdName == null) { game.Chat.Add("&eList of client commands:"); PrintDefinedCommands(game); game.Chat.Add("&eTo see a particular command's help, type /client help [cmd name]"); return; } Command cmd = GetMatch(cmdName); if (cmd != null) { cmd.Execute(reader); } }
bool ParseBlock(CommandReader reader) { string id = reader.Next(); if (id == null) { return(true); } if (Utils.CaselessEquals(id, "yes")) { persist = true; return(true); } byte blockID = 0; if (!byte.TryParse(id, out blockID)) { game.Chat.Add("&eCuboid: &c\"" + id + "\" is not a valid block id."); return(false); } if (blockID >= Block.CpeCount && game.BlockInfo.Name[blockID] == "Invalid") { game.Chat.Add("&eCuboid: &cThere is no block with id \"" + id + "\"."); return(false); } block = blockID; return(true); }
public override void Execute(CommandReader reader) { string property = reader.Next(); if (property == null) { game.Chat.Add("&e/client rendertype: &cYou didn't specify a new render type."); } else if (Utils.CaselessEquals(property, "legacyfast")) { SetNewRenderType(true, true); game.Chat.Add("&e/client rendertype: &fRender type is now fast legacy."); } else if (Utils.CaselessEquals(property, "legacy")) { SetNewRenderType(true, false); game.Chat.Add("&e/client rendertype: &fRender type is now legacy."); } else if (Utils.CaselessEquals(property, "normal")) { SetNewRenderType(false, false); game.Chat.Add("&e/client rendertype: &fRender type is now normal."); } else if (Utils.CaselessEquals(property, "normalfast")) { SetNewRenderType(false, true); game.Chat.Add("&e/client rendertype: &fRender type is now normalfast."); } }
public override void Execute(CommandReader reader) { string name = reader.Next(); if (String.IsNullOrEmpty(name)) { game.Chat.Add("&e/client model: &cYou didn't specify a model name."); } else { game.LocalPlayer.SetModel(Utils.ToLower(name)); } }
public override void Execute(CommandReader reader) { string property = reader.Next(); if (property == null) { game.Chat.Add("&e/client: &cYou didn't specify a new render type."); } else if (game.SetRenderType(property)) { game.Chat.Add("&e/client: &fRender type is now " + property + "."); } else { game.Chat.Add("&e/client: &cUnrecognised render type &f\"" + property + "\"&c."); } }
public void Execute(string text) { CommandReader reader = new CommandReader(text); if (reader.TotalArgs == 0) { game.Chat.Add("&eList of client commands:"); PrintDefinedCommands(game); game.Chat.Add("&eTo see a particular command's help, type /client help [cmd name]"); return; } string commandName = reader.Next(); Command cmd = GetMatchingCommand(commandName); if (cmd != null) { cmd.Execute(reader); } }
public override void Execute(CommandReader reader) { game.UserEvents.BlockChanged -= BlockChanged; block = 0xFF; mark1 = new Vector3I(int.MaxValue); mark2 = new Vector3I(int.MaxValue); persist = false; if (!ParseBlock(reader)) { return; } string arg = reader.Next(); if (arg != null && Utils.CaselessEquals(arg, "yes")) { persist = true; } game.Chat.Add("&eCuboid: &fPlace or delete a block.", MessageType.ClientStatus3); game.UserEvents.BlockChanged += BlockChanged; }
public override void Execute(CommandReader reader) { string property = reader.Next(); if (property == null) { game.Chat.Add("&e/client info: &cYou didn't specify a property."); } else if (Utils.CaselessEquals(property, "pos")) { game.Chat.Add("Feet: " + game.LocalPlayer.Position); game.Chat.Add("Eye: " + game.LocalPlayer.EyePosition); Vector3I p = Vector3I.Floor(game.LocalPlayer.Position); game.Chat.Add(game.World.GetLightHeight(p.X, p.Z).ToString()); } else if (Utils.CaselessEquals(property, "target")) { PickedPos pos = game.SelectedPos; if (!pos.Valid) { game.Chat.Add("Currently not targeting a block"); } else { game.Chat.Add("Currently targeting at: " + pos.BlockPos); game.Chat.Add("ID of block targeted: " + game.World.SafeGetBlock(pos.BlockPos)); } } else if (Utils.CaselessEquals(property, "dimensions")) { game.Chat.Add("map width: " + game.World.Width); game.Chat.Add("map height: " + game.World.Height); game.Chat.Add("map length: " + game.World.Length); } else { game.Chat.Add("&e/client info: Unrecognised property: \"&f" + property + "&e\"."); } }
public override void Execute(CommandReader reader) { string cmdName = reader.Next(); if (cmdName == null) { game.Chat.Add("&eList of client commands:"); game.CommandManager.PrintDefinedCommands(game); game.Chat.Add("&eTo see a particular command's help, type /client help [cmd name]"); } else { Command cmd = game.CommandManager.GetMatchingCommand(cmdName); if (cmd != null) { string[] help = cmd.Help; for (int i = 0; i < help.Length; i++) { game.Chat.Add(help[i]); } } } }