Adding changes to previous patch to make it fit into core better

0.6.8-post-fixes
Melanie 2009-10-28 18:25:37 +00:00
parent bff0d75e0f
commit c17359fea5
1 changed files with 17 additions and 19 deletions

View File

@ -343,9 +343,9 @@ namespace OpenSim
"Add-InventoryHost <host>", "Add-InventoryHost <host>",
String.Empty, RunCommand); String.Empty, RunCommand);
m_console.Commands.AddCommand("region", false, "killuuid", m_console.Commands.AddCommand("region", false, "kill uuid",
"killuuid <UUID>", "kill uuid <UUID>",
"kill an object by UUID", KillUUID); "Kill an object by UUID", KillUUID);
if (ConfigurationSettings.Standalone) if (ConfigurationSettings.Standalone)
{ {
@ -1342,38 +1342,36 @@ namespace OpenSim
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
protected void KillUUID(string module, string[] cmdparams) protected void KillUUID(string module, string[] cmdparams)
{ {
if (cmdparams.Length > 1) if (cmdparams.Length > 2)
{ {
UUID id = UUID.Zero; UUID id = UUID.Zero;
SceneObjectGroup grp = null; SceneObjectGroup grp = null;
Scene sc = null; Scene sc = null;
try if (!UUID.TryParse(cmdparams[2], out id))
{ {
Guid x = new Guid((string)cmdparams[1]); MainConsole.Instance.Output("[KillUUID]: Error bad UUID format!");
id = (UUID)(string)cmdparams[1];
}
catch (Exception)
{
m_log.Error("[KillUUID]: Error bad UUID formating !");
return; return;
} }
m_sceneManager.ForEachScene( m_sceneManager.ForEachScene(
delegate(Scene scene) delegate(Scene scene)
{ {
if (scene.Entities[id] != null) SceneObjectPart part = scene.GetSceneObjectPart(id);
{ if (part == null)
grp = (SceneObjectGroup) scene.Entities[id]; return;
grp = part.ParentGroup;
sc = scene; sc = scene;
}
}); });
if (grp == null) if (grp == null)
m_log.ErrorFormat("[KillUUID]: Given UUID {0} not found !", id); {
MainConsole.Instance.Output(String.Format("[KillUUID]: Given UUID {0} not found!", id));
}
else else
{ {
m_log.InfoFormat("[KillUUID]: Found UUID {0} in scene {1}", id, sc.RegionInfo.RegionName); MainConsole.Instance.Output(String.Format("[KillUUID]: Found UUID {0} in scene {1}", id, sc.RegionInfo.RegionName));
try try
{ {
sc.DeleteSceneObject(grp, false); sc.DeleteSceneObject(grp, false);
@ -1386,7 +1384,7 @@ namespace OpenSim
} }
else else
{ {
m_log.Error("[KillUUID]: Usage: killuuid <UUID>"); MainConsole.Instance.Output("[KillUUID]: Usage: kill uuid <UUID>");
} }
} }