diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index b44818266a..60c34df8bd 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -343,6 +343,10 @@ namespace OpenSim "Add-InventoryHost ", String.Empty, RunCommand); + m_console.Commands.AddCommand("region", false, "kill uuid", + "kill uuid ", + "Kill an object by UUID", KillUUID); + if (ConfigurationSettings.Standalone) { m_console.Commands.AddCommand("region", false, "create user", @@ -1332,6 +1336,58 @@ namespace OpenSim return result; } + /// + /// Kill an object given its UUID. + /// + /// + protected void KillUUID(string module, string[] cmdparams) + { + if (cmdparams.Length > 2) + { + UUID id = UUID.Zero; + SceneObjectGroup grp = null; + Scene sc = null; + + if (!UUID.TryParse(cmdparams[2], out id)) + { + MainConsole.Instance.Output("[KillUUID]: Error bad UUID format!"); + return; + } + + m_sceneManager.ForEachScene( + delegate(Scene scene) + { + SceneObjectPart part = scene.GetSceneObjectPart(id); + if (part == null) + return; + + grp = part.ParentGroup; + sc = scene; + }); + + if (grp == null) + { + MainConsole.Instance.Output(String.Format("[KillUUID]: Given UUID {0} not found!", id)); + } + else + { + MainConsole.Instance.Output(String.Format("[KillUUID]: Found UUID {0} in scene {1}", id, sc.RegionInfo.RegionName)); + try + { + sc.DeleteSceneObject(grp, false); + } + catch (Exception e) + { + m_log.ErrorFormat("[KillUUID]: Error while removing objects from scene: " + e); + } + } + } + else + { + MainConsole.Instance.Output("[KillUUID]: Usage: kill uuid "); + } + } + #endregion } }