public override CommandResult Execute(String arg1, String arg2, String arg3, String arg4) { try { MinecraftHandler mc = (MinecraftHandler)MinecraftHandler; int amount = Convert.ToInt32(arg3); ClientNpc npc = mc.Npcs[arg1]; if (npc != null) { if (arg2 == "x") { npc.Position.X += amount; } if (arg2 == "y") { npc.Position.Y += amount; } if (arg2 == "z") { npc.Position.Z += amount; } } } catch { return(new CommandResult(true, String.Format("Exception while executing CommandNPC"), true)); } return(new CommandResult(true, String.Format("{0} execute by {1}", Name, TriggerPlayer), true)); }
private void btDisconnectNpc_Click(object sender, EventArgs e) { ClientNpc npc = listNpcs.SelectedItem as ClientNpc; if (npc != null) { npc.Disconnect(); mc.Npcs.Remove(npc.Name); } }
private void SpeakThrough() { ClientNpc npc = listNpcs.SelectedItem as ClientNpc; if (npc != null) { npc.SpeakThrough(tbSpeakThrough.Text); } tbSpeakThrough.Text = ""; }
private void btAddNpc_Click(object sender, EventArgs e) { ClientNpc npc = new ClientNpc(mc, tbNpcName.Text, tbPassword.Text); npc.ClientException -= new EventHandler <MinecraftWrapper.WrapperEventArgs.ClientExceptionEventArgs>(npc_ClientException); npc.ClientException += new EventHandler <MinecraftWrapper.WrapperEventArgs.ClientExceptionEventArgs>(npc_ClientException); npc.Connect(); RefreshNpcs(); }
public override CommandResult Execute(String arg1, String arg2, String arg3, String arg4) { try { MinecraftHandler mc = (MinecraftHandler)MinecraftHandler; if (!String.IsNullOrEmpty(arg1)) { if (!mc.IsStringInList(arg1, mc.Player)) { if (!mc.Npcs.ContainsKey(arg1)) { ClientNpc npc = new ClientNpc(mc, arg1, "", TriggerPlayer); npc.Connect(); } } } } catch { return(new CommandResult(true, String.Format("Exception while executing CommandNPC"), true)); } return(new CommandResult(true, String.Format("{0} executed by {1}", Name, TriggerPlayer), true)); }