aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-02-12 00:46:01 +0000
committerJustin Clark-Casey (justincc)2011-02-12 00:46:01 +0000
commit7e21c1eadf28e86b29fdd24b33e29950e195c6db (patch)
tree96a3a7a545ee7957030a06ed6b6be3f8a711fe83 /OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
parentrefactor: split out estate management commands into separate class (diff)
downloadopensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.zip
opensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.tar.gz
opensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.tar.bz2
opensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.tar.xz
Hack in a crude temporary "estate show" command
This will show the estate for each region, along with that estate's id and the estate owner. This is temporary because the command output might change. This commit also converts the estate module from the old to the new region module format
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs74
1 files changed, 71 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 14f5b1e..f6d1a82 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -30,21 +30,29 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Security; 32using System.Security;
33using System.Text;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Console;
39using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
37using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
39 42
40namespace OpenSim.Region.CoreModules.World.Estate 43namespace OpenSim.Region.CoreModules.World.Estate
41{ 44{
45 /// <summary>
46 /// Estate management console commands.
47 /// </summary>
42 public class EstateManagementCommands 48 public class EstateManagementCommands
43 { 49 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 51
46 protected EstateManagementModule m_module; 52 protected EstateManagementModule m_module;
47 53
54 protected Commander m_commander = new Commander("estate");
55
48 public EstateManagementCommands(EstateManagementModule module) 56 public EstateManagementCommands(EstateManagementModule module)
49 { 57 {
50 m_module = module; 58 m_module = module;
@@ -52,20 +60,60 @@ namespace OpenSim.Region.CoreModules.World.Estate
52 60
53 public void Initialise() 61 public void Initialise()
54 { 62 {
55 m_module.Scene.AddCommand(this, "set terrain texture", 63 m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
64
65 m_module.Scene.AddCommand(m_module, "set terrain texture",
56 "set terrain texture <number> <uuid> [<x>] [<y>]", 66 "set terrain texture <number> <uuid> [<x>] [<y>]",
57 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + 67 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
58 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + 68 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
59 " that coordinate.", 69 " that coordinate.",
60 consoleSetTerrainTexture); 70 consoleSetTerrainTexture);
61 71
62 m_module.Scene.AddCommand(this, "set terrain heights", 72 m_module.Scene.AddCommand(m_module, "set terrain heights",
63 "set terrain heights <corner> <min> <max> [<x>] [<y>]", 73 "set terrain heights <corner> <min> <max> [<x>] [<y>]",
64 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + 74 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
65 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + 75 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
66 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", 76 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
67 consoleSetTerrainHeights); 77 consoleSetTerrainHeights);
68 } 78
79 Command showCommand
80 = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator.");
81
82 m_commander.RegisterCommand("show", showCommand);
83
84 m_module.Scene.RegisterModuleCommander(m_commander);
85
86 m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
87 }
88
89 public void Close()
90 {
91 m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
92 m_module.Scene.UnregisterModuleCommander(m_commander.Name);
93 }
94
95 /// <summary>
96 /// Processes commandline input. Do not call directly.
97 /// </summary>
98 /// <param name="args">Commandline arguments</param>
99 protected void EventManagerOnPluginConsole(string[] args)
100 {
101 if (args[0] == "estate")
102 {
103 if (args.Length == 1)
104 {
105 m_commander.ProcessConsoleCommand("help", new string[0]);
106 return;
107 }
108
109 string[] tmpArgs = new string[args.Length - 2];
110 int i;
111 for (i = 2; i < args.Length; i++)
112 tmpArgs[i - 2] = args[i];
113
114 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
115 }
116 }
69 117
70 protected void consoleSetTerrainTexture(string module, string[] args) 118 protected void consoleSetTerrainTexture(string module, string[] args)
71 { 119 {
@@ -152,5 +200,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
152 } 200 }
153 } 201 }
154 } 202 }
203
204 protected void ShowEstatesCommand(Object[] args)
205 {
206 StringBuilder report = new StringBuilder();
207 RegionInfo ri = m_module.Scene.RegionInfo;
208 EstateSettings es = ri.EstateSettings;
209
210 report.AppendFormat("Estate information for region {0}\n", ri.RegionName);
211 report.AppendFormat(
212 "{0,-20} {1,-7} {2,-20}\n",
213 "Estate Name",
214 "ID",
215 "Owner");
216
217 report.AppendFormat(
218 "{0,-20} {1,-7} {2,-20}\n",
219 es.EstateName, es.EstateID, m_module.UserManager.GetUserName(es.EstateOwner));
220
221 MainConsole.Instance.Output(report.ToString());
222 }
155 } 223 }
156} \ No newline at end of file 224} \ No newline at end of file